class ForemanMaintain::Cli::UpgradeCommand

Public Instance Methods

available_target_versions(tag) click to toggle source

We search for scenarios available for the system and determine user-friendly version numbers for it. This method returns a hash of mapping the versions to scenarios to run The tag is determining which kind of scenario we're searching for (such as pre_upgrade_check)

# File lib/foreman_maintain/cli/upgrade_command.rb, line 18
def available_target_versions(tag)
  conditions = { :tags => [tag] }
  find_scenarios(conditions).inject({}) do |hash, scenario|
    # find tag that represent the version upgrade
    version_tag = scenario.tags.find { |t| tags_to_versions.key?(t) }
    if version_tag
      hash.update(tags_to_versions[version_tag] => scenario)
    else
      hash
    end
  end
end
execute() click to toggle source
# File lib/foreman_maintain/cli/upgrade_command.rb, line 36
def execute
  print_versions(available_target_versions(:pre_upgrade_check))
end
print_versions(target_versions) click to toggle source
tags_to_versions() click to toggle source
# File lib/foreman_maintain/cli/upgrade_command.rb, line 4
def tags_to_versions
  { :satellite_6_0_z => '6.0.z',
    :satellite_6_1 => '6.1',
    :satellite_6_1_z => '6.1.z',
    :satellite_6_2 => '6.2',
    :satellite_6_2_z => '6.2.z',
    :satellite_6_3 => '6.3' }
end