class ForemanMaintain::Cli::UpdateCommand
Public Class Methods
disable_self_update_option()
click to toggle source
# File lib/foreman_maintain/cli/update_command.rb, line 6 def self.disable_self_update_option option '--disable-self-update', :flag, 'Disable automatic self update', :default => false end
Public Instance Methods
execute()
click to toggle source
# File lib/foreman_maintain/cli/update_command.rb, line 47 def execute ForemanMaintain.validate_downstream_packages ForemanMaintain.perform_self_upgrade unless disable_self_update? exit_code = try_update do runner = update_runner runner.run_phase(:pre_update_checks) runner.exit_code end exit exit_code end
try_update() { || ... }
click to toggle source
# File lib/foreman_maintain/cli/update_command.rb, line 22 def try_update if update_runner.available? yield else instance = ForemanMaintain.detector.feature(:instance) msg = <<~BANNER This version of #{ForemanMaintain.command_name} only supports #{instance.target_version}, but the installed version of #{instance.product_name} is #{instance.current_major_version}. Therefore the update command is not available right now. Please install a version of #{ForemanMaintain.command_name} that supports #{instance.current_major_version} or perform an upgrade to #{instance.target_version} using the upgrade command. BANNER puts msg ForemanMaintain::UpdateRunner::WARNING_EXIT_CODE end end
update_runner()
click to toggle source
# File lib/foreman_maintain/cli/update_command.rb, line 11 def update_runner update_runner = ForemanMaintain::UpdateRunner.new( reporter, :assumeyes => assumeyes?, :whitelist => whitelist || [], :force => force? ) update_runner.load update_runner end