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
# File lib/foreman_maintain/cli/upgrade_command.rb, line 36 def execute print_versions(available_target_versions(:pre_upgrade_check)) end
# File lib/foreman_maintain/cli/upgrade_command.rb, line 31 def print_versions(target_versions) target_versions.keys.sort.each { |version| puts version } end