class ForemanMaintain::Cli::SelfUpgradeCommand

Public Instance Methods

allow_major_version_upgrade_only() click to toggle source
# File lib/foreman_maintain/cli/self_upgrade_command.rb, line 24
def allow_major_version_upgrade_only
  begin
    next_version = Gem::Version.new(target_version)
  rescue ArgumentError => err
    raise Error::UsageError, "Invalid version! #{err}"
  end
  if current_downstream_version >= next_version
    message = "The target-version #{target_version} should be "                     "greater than existing version #{current_downstream_version}!"
    raise Error::UsageError, message
  end
end
current_downstream_version() click to toggle source
# File lib/foreman_maintain/cli/self_upgrade_command.rb, line 20
def current_downstream_version
  ForemanMaintain.detector.feature(:instance).downstream.current_version
end
execute() click to toggle source
# File lib/foreman_maintain/cli/self_upgrade_command.rb, line 7
def execute
  allow_major_version_upgrade_only
  run_scenario(upgrade_scenario, upgrade_rescue_scenario)
end
upgrade_rescue_scenario() click to toggle source
# File lib/foreman_maintain/cli/self_upgrade_command.rb, line 16
def upgrade_rescue_scenario
  Scenarios::SelfUpgradeRescue.new(target_version: target_version)
end
upgrade_scenario() click to toggle source
# File lib/foreman_maintain/cli/self_upgrade_command.rb, line 12
def upgrade_scenario
  Scenarios::SelfUpgrade.new(target_version: target_version)
end