Class: ForemanMaintain::Cli::UpgradeCommand
- Inherits:
-
Base
- Object
- Clamp::Command
- Base
- ForemanMaintain::Cli::UpgradeCommand
show all
- Defined in:
- lib/foreman_maintain/cli/upgrade_command.rb
Instance Attribute Summary
Attributes inherited from Base
#runner
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#available_checks, #available_procedures, available_tags, #available_tags, completion_map, completion_types, dashize, #dashize, delete_duplicate_assumeyes_if_any, interactive_option, label_option, #label_string, option, #option_wrapper, parameter, #print_check_info, #reporter, #run_scenario, #run_scenarios_and_exit, service_options, subcommand, #tag_string, tags_option, #underscorize
#logger
#check, #detector, #feature, #find_all_scenarios, #find_checks, #find_procedures, #find_scenarios, #procedure
Class Method Details
.disable_self_upgrade_option ⇒ Object
9
10
11
12
|
# File 'lib/foreman_maintain/cli/upgrade_command.rb', line 9
def self.disable_self_upgrade_option
option '--disable-self-upgrade', :flag, 'Disable automatic self upgrade',
:default => false
end
|
.target_version_option ⇒ Object
4
5
6
7
|
# File 'lib/foreman_maintain/cli/upgrade_command.rb', line 4
def self.target_version_option
option '--target-version', 'TARGET_VERSION', 'Target version of the upgrade',
:required => false
end
|
Instance Method Details
#current_target_version ⇒ Object
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/foreman_maintain/cli/upgrade_command.rb', line 14
def current_target_version
current_target_version = ForemanMaintain::UpgradeRunner.current_target_version
if current_target_version && target_version && target_version != current_target_version
raise Error::UsageError,
"Can't set target version #{target_version}, "\
"#{current_target_version} already in progress"
end
@target_version = current_target_version if current_target_version
return true if current_target_version
end
|
#print_versions(target_versions) ⇒ Object
51
52
53
|
# File 'lib/foreman_maintain/cli/upgrade_command.rb', line 51
def print_versions(target_versions)
target_versions.sort.each { |version| puts version }
end
|
#upgrade_runner ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/foreman_maintain/cli/upgrade_command.rb', line 42
def upgrade_runner
return @upgrade_runner if defined? @upgrade_runner
validate_target_version!
@upgrade_runner = ForemanMaintain::UpgradeRunner.new(target_version, reporter,
:assumeyes => assumeyes?,
:whitelist => whitelist || [],
:force => force?).tap(&:load)
end
|
#validate_target_version! ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/foreman_maintain/cli/upgrade_command.rb', line 25
def validate_target_version!
return if current_target_version
unless UpgradeRunner.available_targets.include?(target_version)
message_start = if target_version
"Can't upgrade to #{target_version}"
else
'--target-version not specified'
end
message = <<-MESSAGE.strip_heredoc
#{message_start}
Possible target versions are:
MESSAGE
versions = UpgradeRunner.available_targets.join("\n")
raise Error::UsageError, message + versions
end
end
|