foreman_maintain 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -4
- data/bin/foreman-maintain +1 -1
- data/bin/foreman-maintain-complete +5 -5
- data/definitions/checks/backup/directory_ready.rb +3 -1
- data/definitions/checks/candlepin/db_up.rb +1 -1
- data/definitions/checks/candlepin/validate_db.rb +2 -9
- data/definitions/checks/check_for_newer_packages.rb +5 -5
- data/definitions/checks/check_hotfix_installed.rb +3 -7
- data/definitions/checks/disk/available_space_postgresql12.rb +3 -2
- data/definitions/checks/disk/performance.rb +3 -3
- data/definitions/checks/foreman/check_corrupted_roles.rb +2 -4
- data/definitions/checks/foreman/check_duplicate_permission.rb +1 -1
- data/definitions/checks/foreman/check_duplicate_roles.rb +1 -1
- data/definitions/checks/foreman/check_tuning_requirements.rb +1 -1
- data/definitions/checks/foreman/db_up.rb +1 -1
- data/definitions/checks/foreman/facts_names.rb +4 -4
- data/definitions/checks/foreman_openscap/invalid_report_associations.rb +4 -4
- data/definitions/checks/foreman_proxy/check_tftp_storage.rb +4 -4
- data/definitions/checks/foreman_proxy/verify_dhcp_config_syntax.rb +1 -2
- data/definitions/checks/foreman_tasks/invalid/check_old.rb +2 -2
- data/definitions/checks/foreman_tasks/invalid/check_pending_state.rb +2 -2
- data/definitions/checks/foreman_tasks/invalid/check_planning_state.rb +2 -2
- data/definitions/checks/foreman_tasks/not_paused.rb +2 -2
- data/definitions/checks/foreman_tasks/not_running.rb +6 -6
- data/definitions/checks/original_assets.rb +3 -3
- data/definitions/checks/package_manager/yum/validate_yum_config.rb +1 -1
- data/definitions/checks/pulpcore/db_up.rb +1 -1
- data/definitions/checks/repositories/check_upstream_repository.rb +2 -2
- data/definitions/checks/repositories/validate.rb +2 -2
- data/definitions/checks/restore/validate_backup.rb +2 -2
- data/definitions/checks/restore/validate_hostname.rb +2 -2
- data/definitions/checks/restore/validate_interfaces.rb +2 -2
- data/definitions/checks/restore/validate_postgresql_dump_permissions.rb +31 -0
- data/definitions/checks/services_up.rb +2 -2
- data/definitions/features/apache.rb +1 -1
- data/definitions/features/candlepin.rb +1 -1
- data/definitions/features/candlepin_database.rb +2 -4
- data/definitions/features/cron.rb +3 -5
- data/definitions/features/dynflow_sidekiq.rb +2 -2
- data/definitions/features/foreman_cockpit.rb +1 -1
- data/definitions/features/foreman_database.rb +1 -1
- data/definitions/features/foreman_proxy.rb +1 -1
- data/definitions/features/foreman_server.rb +3 -7
- data/definitions/features/foreman_tasks.rb +9 -12
- data/definitions/features/gofer.rb +1 -1
- data/definitions/features/hammer.rb +4 -4
- data/definitions/features/installer.rb +4 -5
- data/definitions/features/instance.rb +12 -14
- data/definitions/features/katello.rb +8 -12
- data/definitions/features/pulpcore.rb +6 -30
- data/definitions/features/pulpcore_database.rb +3 -1
- data/definitions/features/puppet_server.rb +1 -1
- data/definitions/features/redis.rb +2 -18
- data/definitions/features/salt_server.rb +1 -1
- data/definitions/features/service.rb +4 -48
- data/definitions/features/sync_plans.rb +2 -2
- data/definitions/features/tar.rb +4 -3
- data/definitions/procedures/backup/compress_data.rb +0 -1
- data/definitions/procedures/backup/config_files.rb +6 -5
- data/definitions/procedures/backup/prepare_directory.rb +0 -2
- data/definitions/procedures/backup/pulp.rb +3 -3
- data/definitions/procedures/backup/snapshot/clean_mount.rb +1 -1
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +1 -2
- data/definitions/procedures/backup/snapshot/mount_pulp.rb +2 -2
- data/definitions/procedures/foreman/fix_corrupted_roles.rb +3 -3
- data/definitions/procedures/foreman_tasks/delete.rb +3 -3
- data/definitions/procedures/hammer_setup.rb +1 -1
- data/definitions/procedures/knowledge_base_article.rb +3 -4
- data/definitions/procedures/packages/enable_modules.rb +1 -1
- data/definitions/procedures/packages/install.rb +1 -1
- data/definitions/procedures/packages/uninstall.rb +1 -1
- data/definitions/procedures/packages/update.rb +6 -2
- data/definitions/procedures/pulpcore/migrate.rb +2 -3
- data/definitions/procedures/pulpcore/trim_rpm_changelogs.rb +2 -3
- data/definitions/procedures/remote_execution/remove_existing_settingsd.rb +2 -2
- data/definitions/procedures/repositories/enable.rb +1 -1
- data/definitions/procedures/repositories/setup.rb +2 -2
- data/definitions/procedures/restore/candlepin_dump.rb +2 -2
- data/definitions/procedures/restore/configs.rb +3 -10
- data/definitions/procedures/restore/drop_databases.rb +2 -2
- data/definitions/procedures/restore/extract_files.rb +4 -17
- data/definitions/procedures/restore/foreman_dump.rb +2 -2
- data/definitions/procedures/restore/installer_reset.rb +1 -2
- data/definitions/procedures/restore/postgres_owner.rb +2 -2
- data/definitions/procedures/restore/pulpcore_dump.rb +2 -2
- data/definitions/procedures/selinux/set_file_security.rb +2 -2
- data/definitions/procedures/service/restart.rb +2 -3
- data/definitions/scenarios/backup.rb +47 -65
- data/definitions/scenarios/packages.rb +9 -9
- data/definitions/scenarios/restore.rb +24 -40
- data/definitions/scenarios/self_upgrade.rb +7 -11
- data/definitions/scenarios/services.rb +17 -17
- data/definitions/scenarios/upgrade_to_capsule_6_14.rb +3 -2
- data/definitions/scenarios/upgrade_to_capsule_6_14_z.rb +3 -2
- data/definitions/scenarios/upgrade_to_katello_nightly.rb +3 -0
- data/definitions/scenarios/upgrade_to_satellite_6_14.rb +3 -2
- data/definitions/scenarios/upgrade_to_satellite_6_14_z.rb +3 -2
- data/extras/foreman_protector/dnf/foreman-protector.py +4 -4
- data/extras/foreman_protector/foreman-protector.whitelist +0 -6
- data/lib/foreman_maintain/cli/advanced/prebuild_bash_completion.rb +1 -1
- data/lib/foreman_maintain/cli/advanced_command.rb +2 -2
- data/lib/foreman_maintain/cli/backup_command.rb +17 -17
- data/lib/foreman_maintain/cli/base.rb +13 -13
- data/lib/foreman_maintain/cli/maintenance_mode_command.rb +1 -1
- data/lib/foreman_maintain/cli/plugin_command.rb +1 -1
- data/lib/foreman_maintain/cli/restore_command.rb +4 -4
- data/lib/foreman_maintain/cli/self_upgrade_command.rb +2 -2
- data/lib/foreman_maintain/cli/service_command.rb +2 -2
- data/lib/foreman_maintain/cli/transform_clamp_options.rb +1 -1
- data/lib/foreman_maintain/cli/upgrade_command.rb +7 -7
- data/lib/foreman_maintain/cli.rb +1 -11
- data/lib/foreman_maintain/concerns/base_database.rb +8 -17
- data/lib/foreman_maintain/concerns/downstream.rb +6 -64
- data/lib/foreman_maintain/concerns/firewall/iptables_maintenance_mode.rb +1 -1
- data/lib/foreman_maintain/concerns/foreman_and_katello_version_map.rb +1 -1
- data/lib/foreman_maintain/concerns/os_facts.rb +0 -8
- data/lib/foreman_maintain/concerns/primary_checks.rb +6 -5
- data/lib/foreman_maintain/concerns/pulp_common.rb +5 -8
- data/lib/foreman_maintain/concerns/system_helpers.rb +3 -6
- data/lib/foreman_maintain/concerns/upstream.rb +3 -3
- data/lib/foreman_maintain/config.rb +7 -7
- data/lib/foreman_maintain/core_ext.rb +2 -2
- data/lib/foreman_maintain/executable.rb +7 -9
- data/lib/foreman_maintain/package_manager/apt.rb +2 -2
- data/lib/foreman_maintain/package_manager/base.rb +0 -2
- data/lib/foreman_maintain/package_manager/dnf.rb +2 -2
- data/lib/foreman_maintain/package_manager/yum.rb +3 -4
- data/lib/foreman_maintain/package_manager.rb +7 -9
- data/lib/foreman_maintain/param.rb +2 -2
- data/lib/foreman_maintain/reporter/cli_reporter.rb +6 -7
- data/lib/foreman_maintain/reporter.rb +15 -10
- data/lib/foreman_maintain/repository_manager/el.rb +2 -10
- data/lib/foreman_maintain/repository_manager.rb +2 -1
- data/lib/foreman_maintain/runner.rb +5 -5
- data/lib/foreman_maintain/scenario.rb +4 -2
- data/lib/foreman_maintain/upgrade_runner.rb +0 -2
- data/lib/foreman_maintain/utils/backup.rb +27 -111
- data/lib/foreman_maintain/utils/bash.rb +18 -19
- data/lib/foreman_maintain/utils/command_runner.rb +5 -9
- data/lib/foreman_maintain/utils/hash_tools.rb +5 -5
- data/lib/foreman_maintain/utils/response.rb +1 -0
- data/lib/foreman_maintain/utils/service/remote_db.rb +1 -0
- data/lib/foreman_maintain/utils/service/systemd.rb +7 -5
- data/lib/foreman_maintain/utils/service.rb +1 -1
- data/lib/foreman_maintain/utils.rb +0 -1
- data/lib/foreman_maintain/version.rb +1 -1
- data/lib/foreman_maintain/yaml_storage.rb +1 -0
- data/lib/foreman_maintain.rb +7 -6
- metadata +29 -78
- data/definitions/checks/foreman/check_https_proxies.rb +0 -34
- data/definitions/checks/mongo/db_up.rb +0 -33
- data/definitions/checks/mongo/tools_installed.rb +0 -31
- data/definitions/checks/pulpcore/group_ownership_check.rb +0 -18
- data/definitions/checks/puppet/provide_upgrade_guide.rb +0 -35
- data/definitions/checks/puppet/warn_about_puppet_removal.rb +0 -35
- data/definitions/checks/remote_execution/verify_settings_file_already_exists.rb +0 -42
- data/definitions/features/mongo.rb +0 -217
- data/definitions/features/pulp2.rb +0 -35
- data/definitions/procedures/backup/offline/mongo.rb +0 -56
- data/definitions/procedures/backup/online/mongo.rb +0 -21
- data/definitions/procedures/backup/snapshot/mount_mongo.rb +0 -43
- data/definitions/procedures/candlepin/delete_orphaned_records_from_env_content.rb +0 -40
- data/definitions/procedures/content/fix_pulpcore_artifact_permissions.rb +0 -31
- data/definitions/procedures/content/migration_reset.rb +0 -12
- data/definitions/procedures/content/migration_stats.rb +0 -12
- data/definitions/procedures/content/prepare.rb +0 -17
- data/definitions/procedures/content/prepare_abort.rb +0 -12
- data/definitions/procedures/content/switchover.rb +0 -41
- data/definitions/procedures/prep_6_10_upgrade.rb +0 -29
- data/definitions/procedures/pulp/cleanup_old_metadata_files.rb +0 -75
- data/definitions/procedures/pulp/migrate.rb +0 -23
- data/definitions/procedures/pulp/print_remove_instructions.rb +0 -16
- data/definitions/procedures/pulp/remove.rb +0 -222
- data/definitions/procedures/restore/ensure_mongo_engine_matches.rb +0 -35
- data/definitions/procedures/restore/mongo_dump.rb +0 -41
- data/definitions/procedures/restore/regenerate_queues.rb +0 -69
- data/definitions/scenarios/content.rb +0 -158
- data/definitions/scenarios/prep_6_10_upgrade.rb +0 -13
- data/definitions/scenarios/upgrade_to_capsule_6_10.rb +0 -89
- data/definitions/scenarios/upgrade_to_capsule_6_10_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_11.rb +0 -91
- data/definitions/scenarios/upgrade_to_capsule_6_11_z.rb +0 -90
- data/definitions/scenarios/upgrade_to_capsule_6_12.rb +0 -92
- data/definitions/scenarios/upgrade_to_capsule_6_12_z.rb +0 -92
- data/definitions/scenarios/upgrade_to_capsule_6_13.rb +0 -92
- data/definitions/scenarios/upgrade_to_capsule_6_13_z.rb +0 -92
- data/definitions/scenarios/upgrade_to_capsule_6_8.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_8_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_9.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_9_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_10.rb +0 -113
- data/definitions/scenarios/upgrade_to_satellite_6_10_z.rb +0 -89
- data/definitions/scenarios/upgrade_to_satellite_6_11.rb +0 -96
- data/definitions/scenarios/upgrade_to_satellite_6_11_z.rb +0 -91
- data/definitions/scenarios/upgrade_to_satellite_6_12.rb +0 -95
- data/definitions/scenarios/upgrade_to_satellite_6_12_z.rb +0 -94
- data/definitions/scenarios/upgrade_to_satellite_6_13.rb +0 -95
- data/definitions/scenarios/upgrade_to_satellite_6_13_z.rb +0 -94
- data/definitions/scenarios/upgrade_to_satellite_6_2.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_2_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_3.rb +0 -89
- data/definitions/scenarios/upgrade_to_satellite_6_3_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_4.rb +0 -89
- data/definitions/scenarios/upgrade_to_satellite_6_4_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_5.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_5_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_6.rb +0 -90
- data/definitions/scenarios/upgrade_to_satellite_6_6_z.rb +0 -90
- data/definitions/scenarios/upgrade_to_satellite_6_7.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_7_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_8.rb +0 -91
- data/definitions/scenarios/upgrade_to_satellite_6_8_z.rb +0 -89
- data/definitions/scenarios/upgrade_to_satellite_6_9.rb +0 -91
- data/definitions/scenarios/upgrade_to_satellite_6_9_z.rb +0 -89
- data/lib/foreman_maintain/cli/content_command.rb +0 -69
- data/lib/foreman_maintain/utils/mongo_core.rb +0 -86
@@ -68,37 +68,36 @@ module ForemanMaintain
|
|
68
68
|
|
69
69
|
def traverse_tree(dict, path)
|
70
70
|
return [dict, []] if path.nil? || path.empty?
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
result
|
71
|
+
if dict.key?(path.first)
|
72
|
+
if path.first.start_with?('-')
|
73
|
+
parse_option(dict, path)
|
74
|
+
else
|
75
|
+
parse_subcommand(dict, path)
|
76
|
+
end
|
77
|
+
elsif dict[:params]
|
78
|
+
# traverse params one by one
|
79
|
+
parse_params(dict, path)
|
80
|
+
else
|
81
|
+
# not found
|
82
|
+
[{}, path]
|
83
|
+
end
|
85
84
|
end
|
86
85
|
|
87
86
|
def parse_params(dict, path)
|
88
|
-
traverse_tree({ :params => dict[:params][1
|
87
|
+
traverse_tree({ :params => dict[:params][1..] }, path[1..])
|
89
88
|
end
|
90
89
|
|
91
90
|
def parse_subcommand(dict, path)
|
92
|
-
traverse_tree(dict[path.first], path[1
|
91
|
+
traverse_tree(dict[path.first], path[1..])
|
93
92
|
end
|
94
93
|
|
95
94
|
def parse_option(dict, path)
|
96
95
|
if dict[path.first][:type] == :flag # flag
|
97
|
-
traverse_tree(dict, path[1
|
96
|
+
traverse_tree(dict, path[1..])
|
98
97
|
elsif path.length >= 2 # option with value
|
99
|
-
traverse_tree(dict, path[2
|
98
|
+
traverse_tree(dict, path[2..])
|
100
99
|
else # option with value missing
|
101
|
-
[dict[path.first], path[1
|
100
|
+
[dict[path.first], path[1..]]
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
@@ -21,15 +21,13 @@ module ForemanMaintain
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run
|
24
|
-
|
25
|
-
logger.debug(hide_strings("Running command #{@command} with stdin #{@stdin.inspect}"))
|
26
|
-
end
|
24
|
+
logger&.debug(hide_strings("Running command #{@command} with stdin #{@stdin.inspect}"))
|
27
25
|
if @interactive
|
28
26
|
run_interactively
|
29
27
|
else
|
30
28
|
run_non_interactively
|
31
29
|
end
|
32
|
-
logger
|
30
|
+
logger&.debug("output of the command:\n #{hide_strings(output)}")
|
33
31
|
end
|
34
32
|
|
35
33
|
def interactive?
|
@@ -52,14 +50,13 @@ module ForemanMaintain
|
|
52
50
|
|
53
51
|
def execution_error
|
54
52
|
raise Error::ExecutionError.new(hide_strings(@command),
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
exit_status,
|
54
|
+
hide_strings(@stdin),
|
55
|
+
@interactive ? nil : hide_strings(@output))
|
58
56
|
end
|
59
57
|
|
60
58
|
private
|
61
59
|
|
62
|
-
# rubocop:disable Metrics/MethodLength
|
63
60
|
def run_interactively
|
64
61
|
# use tmp files to capture output and exit status of the command when
|
65
62
|
# running interactively
|
@@ -82,7 +79,6 @@ module ForemanMaintain
|
|
82
79
|
log_file.close
|
83
80
|
exit_file.close
|
84
81
|
end
|
85
|
-
# rubocop:enable Metrics/MethodLength
|
86
82
|
|
87
83
|
def run_non_interactively
|
88
84
|
IO.popen(full_command, 'r+') do |f|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module ForemanMaintain::Utils
|
2
2
|
module HashTools
|
3
|
-
def self.deep_merge!(
|
4
|
-
|
3
|
+
def self.deep_merge!(hash, other_hash)
|
4
|
+
other_hash = symbolize_hash(other_hash)
|
5
5
|
|
6
|
-
|
6
|
+
hash.merge!(other_hash) do |_key, old_val, new_val|
|
7
7
|
if old_val.is_a?(Hash) && new_val.is_a?(Hash)
|
8
8
|
deep_merge!(old_val, new_val)
|
9
9
|
elsif old_val.is_a?(Array) && new_val.is_a?(Array)
|
@@ -14,8 +14,8 @@ module ForemanMaintain::Utils
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.symbolize_hash(
|
18
|
-
|
17
|
+
def self.symbolize_hash(hash)
|
18
|
+
hash.inject({}) { |sym_hash, (key, value)| sym_hash.update(key.to_sym => value) }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -2,6 +2,7 @@ module ForemanMaintain::Utils
|
|
2
2
|
module Service
|
3
3
|
class Systemd < Abstract
|
4
4
|
attr_reader :instance_parent_unit
|
5
|
+
|
5
6
|
def initialize(name, priority, options = {})
|
6
7
|
super
|
7
8
|
@sys = SystemHelpers.new
|
@@ -32,6 +33,10 @@ module ForemanMaintain::Utils
|
|
32
33
|
execute('stop')
|
33
34
|
end
|
34
35
|
|
36
|
+
def restart
|
37
|
+
execute('restart')
|
38
|
+
end
|
39
|
+
|
35
40
|
def enable
|
36
41
|
execute('enable')
|
37
42
|
end
|
@@ -46,8 +51,7 @@ module ForemanMaintain::Utils
|
|
46
51
|
|
47
52
|
def exist?
|
48
53
|
if @sys.systemd_installed?
|
49
|
-
|
50
|
-
systemd == 'enabled' || systemd == 'disabled'
|
54
|
+
['enabled', 'disabled'].include?(service_enabled_status)
|
51
55
|
else
|
52
56
|
File.exist?("/etc/init.d/#{@name}")
|
53
57
|
end
|
@@ -73,14 +77,12 @@ module ForemanMaintain::Utils
|
|
73
77
|
# Enable and disable does not work well with globs since they treat them literally.
|
74
78
|
# We are skipping the pulpcore-workers@* for these actions until they are configured in
|
75
79
|
# a more managable way with systemd
|
76
|
-
# rubocop:disable Layout/IndentAssignment
|
77
80
|
msg =
|
78
|
-
"
|
81
|
+
"
|
79
82
|
\nWARNING: Skipping #{action} for #{name} as there are a variable amount of services to manage
|
80
83
|
and this command will not respond to glob operators. These services have been configured by
|
81
84
|
the installer and it is recommended to keep them enabled to prevent misconfiguration.\n
|
82
85
|
"
|
83
|
-
# rubocop:enable Layout/IndentAssignment
|
84
86
|
puts msg
|
85
87
|
end
|
86
88
|
end
|
@@ -5,7 +5,7 @@ require 'foreman_maintain/utils/service/remote_db'
|
|
5
5
|
module ForemanMaintain::Utils
|
6
6
|
def self.system_service(name, priority, options = {})
|
7
7
|
db_feature = options.fetch(:db_feature, nil)
|
8
|
-
if db_feature
|
8
|
+
if db_feature.respond_to?(:local?) && !db_feature.local?
|
9
9
|
Service::RemoteDB.new(name, priority, options)
|
10
10
|
else
|
11
11
|
Service::Systemd.new(name, priority, options)
|
@@ -4,6 +4,5 @@ require 'foreman_maintain/utils/disk'
|
|
4
4
|
require 'foreman_maintain/utils/bash'
|
5
5
|
require 'foreman_maintain/utils/hash_tools'
|
6
6
|
require 'foreman_maintain/utils/curl_response'
|
7
|
-
require 'foreman_maintain/utils/mongo_core'
|
8
7
|
require 'foreman_maintain/utils/service'
|
9
8
|
require 'foreman_maintain/utils/system_helpers'
|
data/lib/foreman_maintain.rb
CHANGED
@@ -60,7 +60,7 @@ module ForemanMaintain
|
|
60
60
|
'warn' => ::Logger::WARN,
|
61
61
|
'error' => ::Logger::ERROR,
|
62
62
|
'fatal' => ::Logger::FATAL,
|
63
|
-
'unknown' => ::Logger::UNKNOWN
|
63
|
+
'unknown' => ::Logger::UNKNOWN,
|
64
64
|
}.freeze
|
65
65
|
|
66
66
|
def setup(options = {})
|
@@ -98,7 +98,7 @@ module ForemanMaintain
|
|
98
98
|
$LOAD_PATH.concat(config.definitions_dirs)
|
99
99
|
config.definitions_dirs.each do |definitions_dir|
|
100
100
|
file_paths = File.expand_path(File.join(definitions_dir, '**', '*.rb'))
|
101
|
-
Dir.glob(file_paths).each { |f| require f }
|
101
|
+
Dir.glob(file_paths).sort.each { |f| require f }
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -143,7 +143,7 @@ module ForemanMaintain
|
|
143
143
|
# convert size in KB to Bytes
|
144
144
|
log_fsize = config.log_file_size.to_i * 1024
|
145
145
|
@logger = Logger.new(config.log_filename, 10, log_fsize).tap do |logger|
|
146
|
-
logger.level = LOGGER_LEVEL_MAPPING[config.log_level] || Logger::
|
146
|
+
logger.level = LOGGER_LEVEL_MAPPING[config.log_level] || Logger::INFO
|
147
147
|
logger.datetime_format = '%Y-%m-%d %H:%M:%S%z '
|
148
148
|
end
|
149
149
|
pickup_log_messages
|
@@ -180,10 +180,11 @@ module ForemanMaintain
|
|
180
180
|
puts "Checking for new version of #{package_name}..."
|
181
181
|
|
182
182
|
enable_maintenance_module
|
183
|
+
package_manager = ForemanMaintain.package_manager
|
183
184
|
|
184
|
-
if
|
185
|
+
if package_manager.update_available?(main_package_name)
|
185
186
|
puts "\nUpdating #{package_name} package."
|
186
|
-
|
187
|
+
package_manager.update(main_package_name, :assumeyes => true)
|
187
188
|
puts "\nThe #{package_name} package successfully updated."\
|
188
189
|
"\nRe-run #{command} with required options!"
|
189
190
|
exit 75
|
@@ -192,7 +193,7 @@ module ForemanMaintain
|
|
192
193
|
end
|
193
194
|
|
194
195
|
def enable_maintenance_module
|
195
|
-
return unless el?
|
196
|
+
return unless el?
|
196
197
|
|
197
198
|
maintenance_module = 'satellite-maintenance:el8'
|
198
199
|
package_manager = ForemanMaintain.package_manager
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_maintain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: minitest-reporters
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: minitest-stub-const
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,21 +95,35 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: mocha
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: theforeman-rubocop
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ">="
|
@@ -159,7 +173,6 @@ files:
|
|
159
173
|
- definitions/checks/foreman/check_corrupted_roles.rb
|
160
174
|
- definitions/checks/foreman/check_duplicate_permission.rb
|
161
175
|
- definitions/checks/foreman/check_duplicate_roles.rb
|
162
|
-
- definitions/checks/foreman/check_https_proxies.rb
|
163
176
|
- definitions/checks/foreman/check_puppet_capsules.rb
|
164
177
|
- definitions/checks/foreman/check_tuning_requirements.rb
|
165
178
|
- definitions/checks/foreman/db_up.rb
|
@@ -175,23 +188,18 @@ files:
|
|
175
188
|
- definitions/checks/foreman_tasks/not_paused.rb
|
176
189
|
- definitions/checks/foreman_tasks/not_running.rb
|
177
190
|
- definitions/checks/maintenance_mode/check_consistency.rb
|
178
|
-
- definitions/checks/mongo/db_up.rb
|
179
|
-
- definitions/checks/mongo/tools_installed.rb
|
180
191
|
- definitions/checks/non_rh_packages.rb
|
181
192
|
- definitions/checks/original_assets.rb
|
182
193
|
- definitions/checks/package_manager/yum/validate_yum_config.rb
|
183
194
|
- definitions/checks/pulpcore/db_up.rb
|
184
|
-
- definitions/checks/pulpcore/group_ownership_check.rb
|
185
|
-
- definitions/checks/puppet/provide_upgrade_guide.rb
|
186
195
|
- definitions/checks/puppet/verify_no_empty_cacert_requests.rb
|
187
|
-
- definitions/checks/puppet/warn_about_puppet_removal.rb
|
188
|
-
- definitions/checks/remote_execution/verify_settings_file_already_exists.rb
|
189
196
|
- definitions/checks/repositories/check_non_rh_repository.rb
|
190
197
|
- definitions/checks/repositories/check_upstream_repository.rb
|
191
198
|
- definitions/checks/repositories/validate.rb
|
192
199
|
- definitions/checks/restore/validate_backup.rb
|
193
200
|
- definitions/checks/restore/validate_hostname.rb
|
194
201
|
- definitions/checks/restore/validate_interfaces.rb
|
202
|
+
- definitions/checks/restore/validate_postgresql_dump_permissions.rb
|
195
203
|
- definitions/checks/root_user.rb
|
196
204
|
- definitions/checks/server_ping.rb
|
197
205
|
- definitions/checks/services_up.rb
|
@@ -216,10 +224,8 @@ files:
|
|
216
224
|
- definitions/features/iptables.rb
|
217
225
|
- definitions/features/katello.rb
|
218
226
|
- definitions/features/katello_install.rb
|
219
|
-
- definitions/features/mongo.rb
|
220
227
|
- definitions/features/mosquitto.rb
|
221
228
|
- definitions/features/nftables.rb
|
222
|
-
- definitions/features/pulp2.rb
|
223
229
|
- definitions/features/pulpcore.rb
|
224
230
|
- definitions/features/pulpcore_database.rb
|
225
231
|
- definitions/features/puppet_server.rb
|
@@ -236,11 +242,9 @@ files:
|
|
236
242
|
- definitions/procedures/backup/metadata.rb
|
237
243
|
- definitions/procedures/backup/offline/candlepin_db.rb
|
238
244
|
- definitions/procedures/backup/offline/foreman_db.rb
|
239
|
-
- definitions/procedures/backup/offline/mongo.rb
|
240
245
|
- definitions/procedures/backup/offline/pulpcore_db.rb
|
241
246
|
- definitions/procedures/backup/online/candlepin_db.rb
|
242
247
|
- definitions/procedures/backup/online/foreman_db.rb
|
243
|
-
- definitions/procedures/backup/online/mongo.rb
|
244
248
|
- definitions/procedures/backup/online/pulpcore_db.rb
|
245
249
|
- definitions/procedures/backup/online/safety_confirmation.rb
|
246
250
|
- definitions/procedures/backup/prepare_directory.rb
|
@@ -250,17 +254,9 @@ files:
|
|
250
254
|
- definitions/procedures/backup/snapshot/mount_base.rb
|
251
255
|
- definitions/procedures/backup/snapshot/mount_candlepin_db.rb
|
252
256
|
- definitions/procedures/backup/snapshot/mount_foreman_db.rb
|
253
|
-
- definitions/procedures/backup/snapshot/mount_mongo.rb
|
254
257
|
- definitions/procedures/backup/snapshot/mount_pulp.rb
|
255
258
|
- definitions/procedures/backup/snapshot/mount_pulpcore_db.rb
|
256
259
|
- definitions/procedures/backup/snapshot/prepare_mount.rb
|
257
|
-
- definitions/procedures/candlepin/delete_orphaned_records_from_env_content.rb
|
258
|
-
- definitions/procedures/content/fix_pulpcore_artifact_permissions.rb
|
259
|
-
- definitions/procedures/content/migration_reset.rb
|
260
|
-
- definitions/procedures/content/migration_stats.rb
|
261
|
-
- definitions/procedures/content/prepare.rb
|
262
|
-
- definitions/procedures/content/prepare_abort.rb
|
263
|
-
- definitions/procedures/content/switchover.rb
|
264
260
|
- definitions/procedures/crond/start.rb
|
265
261
|
- definitions/procedures/crond/stop.rb
|
266
262
|
- definitions/procedures/files/remove.rb
|
@@ -295,11 +291,6 @@ files:
|
|
295
291
|
- definitions/procedures/packages/unlock_versions.rb
|
296
292
|
- definitions/procedures/packages/update.rb
|
297
293
|
- definitions/procedures/packages/update_all_confirmation.rb
|
298
|
-
- definitions/procedures/prep_6_10_upgrade.rb
|
299
|
-
- definitions/procedures/pulp/cleanup_old_metadata_files.rb
|
300
|
-
- definitions/procedures/pulp/migrate.rb
|
301
|
-
- definitions/procedures/pulp/print_remove_instructions.rb
|
302
|
-
- definitions/procedures/pulp/remove.rb
|
303
294
|
- definitions/procedures/pulpcore/migrate.rb
|
304
295
|
- definitions/procedures/pulpcore/trim_rpm_changelogs.rb
|
305
296
|
- definitions/procedures/puppet/delete_empty_ca_cert_request_files.rb
|
@@ -316,14 +307,11 @@ files:
|
|
316
307
|
- definitions/procedures/restore/configs.rb
|
317
308
|
- definitions/procedures/restore/confirmation.rb
|
318
309
|
- definitions/procedures/restore/drop_databases.rb
|
319
|
-
- definitions/procedures/restore/ensure_mongo_engine_matches.rb
|
320
310
|
- definitions/procedures/restore/extract_files.rb
|
321
311
|
- definitions/procedures/restore/foreman_dump.rb
|
322
312
|
- definitions/procedures/restore/installer_reset.rb
|
323
|
-
- definitions/procedures/restore/mongo_dump.rb
|
324
313
|
- definitions/procedures/restore/postgres_owner.rb
|
325
314
|
- definitions/procedures/restore/pulpcore_dump.rb
|
326
|
-
- definitions/procedures/restore/regenerate_queues.rb
|
327
315
|
- definitions/procedures/restore/reindex_databases.rb
|
328
316
|
- definitions/procedures/selinux/set_file_security.rb
|
329
317
|
- definitions/procedures/service/base.rb
|
@@ -338,56 +326,18 @@ files:
|
|
338
326
|
- definitions/procedures/sync_plans/disable.rb
|
339
327
|
- definitions/procedures/sync_plans/enable.rb
|
340
328
|
- definitions/scenarios/backup.rb
|
341
|
-
- definitions/scenarios/content.rb
|
342
329
|
- definitions/scenarios/maintenance_mode.rb
|
343
330
|
- definitions/scenarios/packages.rb
|
344
|
-
- definitions/scenarios/prep_6_10_upgrade.rb
|
345
331
|
- definitions/scenarios/puppet.rb
|
346
332
|
- definitions/scenarios/restore.rb
|
347
333
|
- definitions/scenarios/self_upgrade.rb
|
348
334
|
- definitions/scenarios/services.rb
|
349
|
-
- definitions/scenarios/upgrade_to_capsule_6_10.rb
|
350
|
-
- definitions/scenarios/upgrade_to_capsule_6_10_z.rb
|
351
|
-
- definitions/scenarios/upgrade_to_capsule_6_11.rb
|
352
|
-
- definitions/scenarios/upgrade_to_capsule_6_11_z.rb
|
353
|
-
- definitions/scenarios/upgrade_to_capsule_6_12.rb
|
354
|
-
- definitions/scenarios/upgrade_to_capsule_6_12_z.rb
|
355
|
-
- definitions/scenarios/upgrade_to_capsule_6_13.rb
|
356
|
-
- definitions/scenarios/upgrade_to_capsule_6_13_z.rb
|
357
335
|
- definitions/scenarios/upgrade_to_capsule_6_14.rb
|
358
336
|
- definitions/scenarios/upgrade_to_capsule_6_14_z.rb
|
359
|
-
- definitions/scenarios/upgrade_to_capsule_6_8.rb
|
360
|
-
- definitions/scenarios/upgrade_to_capsule_6_8_z.rb
|
361
|
-
- definitions/scenarios/upgrade_to_capsule_6_9.rb
|
362
|
-
- definitions/scenarios/upgrade_to_capsule_6_9_z.rb
|
363
337
|
- definitions/scenarios/upgrade_to_foreman_nightly.rb
|
364
338
|
- definitions/scenarios/upgrade_to_katello_nightly.rb
|
365
|
-
- definitions/scenarios/upgrade_to_satellite_6_10.rb
|
366
|
-
- definitions/scenarios/upgrade_to_satellite_6_10_z.rb
|
367
|
-
- definitions/scenarios/upgrade_to_satellite_6_11.rb
|
368
|
-
- definitions/scenarios/upgrade_to_satellite_6_11_z.rb
|
369
|
-
- definitions/scenarios/upgrade_to_satellite_6_12.rb
|
370
|
-
- definitions/scenarios/upgrade_to_satellite_6_12_z.rb
|
371
|
-
- definitions/scenarios/upgrade_to_satellite_6_13.rb
|
372
|
-
- definitions/scenarios/upgrade_to_satellite_6_13_z.rb
|
373
339
|
- definitions/scenarios/upgrade_to_satellite_6_14.rb
|
374
340
|
- definitions/scenarios/upgrade_to_satellite_6_14_z.rb
|
375
|
-
- definitions/scenarios/upgrade_to_satellite_6_2.rb
|
376
|
-
- definitions/scenarios/upgrade_to_satellite_6_2_z.rb
|
377
|
-
- definitions/scenarios/upgrade_to_satellite_6_3.rb
|
378
|
-
- definitions/scenarios/upgrade_to_satellite_6_3_z.rb
|
379
|
-
- definitions/scenarios/upgrade_to_satellite_6_4.rb
|
380
|
-
- definitions/scenarios/upgrade_to_satellite_6_4_z.rb
|
381
|
-
- definitions/scenarios/upgrade_to_satellite_6_5.rb
|
382
|
-
- definitions/scenarios/upgrade_to_satellite_6_5_z.rb
|
383
|
-
- definitions/scenarios/upgrade_to_satellite_6_6.rb
|
384
|
-
- definitions/scenarios/upgrade_to_satellite_6_6_z.rb
|
385
|
-
- definitions/scenarios/upgrade_to_satellite_6_7.rb
|
386
|
-
- definitions/scenarios/upgrade_to_satellite_6_7_z.rb
|
387
|
-
- definitions/scenarios/upgrade_to_satellite_6_8.rb
|
388
|
-
- definitions/scenarios/upgrade_to_satellite_6_8_z.rb
|
389
|
-
- definitions/scenarios/upgrade_to_satellite_6_9.rb
|
390
|
-
- definitions/scenarios/upgrade_to_satellite_6_9_z.rb
|
391
341
|
- extras/foreman-maintain.sh
|
392
342
|
- extras/foreman_protector/dnf/foreman-protector.py
|
393
343
|
- extras/foreman_protector/foreman-protector.conf
|
@@ -405,7 +355,6 @@ files:
|
|
405
355
|
- lib/foreman_maintain/cli/advanced_command.rb
|
406
356
|
- lib/foreman_maintain/cli/backup_command.rb
|
407
357
|
- lib/foreman_maintain/cli/base.rb
|
408
|
-
- lib/foreman_maintain/cli/content_command.rb
|
409
358
|
- lib/foreman_maintain/cli/health_command.rb
|
410
359
|
- lib/foreman_maintain/cli/maintenance_mode_command.rb
|
411
360
|
- lib/foreman_maintain/cli/packages_command.rb
|
@@ -472,7 +421,6 @@ files:
|
|
472
421
|
- lib/foreman_maintain/utils/disk/nil_device.rb
|
473
422
|
- lib/foreman_maintain/utils/disk/stats.rb
|
474
423
|
- lib/foreman_maintain/utils/hash_tools.rb
|
475
|
-
- lib/foreman_maintain/utils/mongo_core.rb
|
476
424
|
- lib/foreman_maintain/utils/response.rb
|
477
425
|
- lib/foreman_maintain/utils/service.rb
|
478
426
|
- lib/foreman_maintain/utils/service/abstract.rb
|
@@ -493,7 +441,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
493
441
|
requirements:
|
494
442
|
- - ">="
|
495
443
|
- !ruby/object:Gem::Version
|
496
|
-
version: '
|
444
|
+
version: '2.7'
|
445
|
+
- - "<"
|
446
|
+
- !ruby/object:Gem::Version
|
447
|
+
version: '4'
|
497
448
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
498
449
|
requirements:
|
499
450
|
- - ">="
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Checks
|
2
|
-
class CheckHttpsProxies < ForemanMaintain::Check
|
3
|
-
metadata do
|
4
|
-
label :https_proxies
|
5
|
-
for_feature :foreman_database
|
6
|
-
description 'Check for HTTPS proxies from the database'
|
7
|
-
manual_detection
|
8
|
-
end
|
9
|
-
|
10
|
-
def run
|
11
|
-
https_proxies = find_https_proxies
|
12
|
-
unless https_proxies.empty?
|
13
|
-
https_proxy_names = https_proxies.map { |proxy| proxy['name'] }
|
14
|
-
question = "Syncing repositories through an 'HTTP Proxy' that uses the HTTPS\n"\
|
15
|
-
"protocol is not supported directly with Satellite 6.10.\n"\
|
16
|
-
"The following proxies use HTTPS: #{https_proxy_names.join(', ')}.\n"\
|
17
|
-
"For a suggested solution see https://access.redhat.com/solutions/6414991\n"\
|
18
|
-
'Continue upgrade?'
|
19
|
-
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
|
20
|
-
abort! if answer != :yes
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def find_https_proxies
|
25
|
-
feature(:foreman_database).query(self.class.query_to_get_https_proxies)
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.query_to_get_https_proxies
|
29
|
-
<<-SQL
|
30
|
-
SELECT \"http_proxies\".* FROM \"http_proxies\" WHERE (http_proxies.url ilike 'https://%')
|
31
|
-
SQL
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Checks
|
2
|
-
module Mongo
|
3
|
-
class DBUp < ForemanMaintain::Check
|
4
|
-
metadata do
|
5
|
-
description 'Make sure Mongo DB is up'
|
6
|
-
label :mongo_db_up
|
7
|
-
for_feature :mongo
|
8
|
-
end
|
9
|
-
|
10
|
-
def run
|
11
|
-
status = false
|
12
|
-
if feature(:mongo).mongo_cmd_available?
|
13
|
-
with_spinner('Checking connection to the Mongo DB') do
|
14
|
-
status = feature(:mongo).ping
|
15
|
-
end
|
16
|
-
assert(status, 'Mongo DB is not responding. ' \
|
17
|
-
'It needs to be up and running to perform the following steps.',
|
18
|
-
:next_steps => start_mongodb)
|
19
|
-
else
|
20
|
-
feature(:mongo).raise_mongo_client_missing_error
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def start_mongodb
|
25
|
-
if feature(:mongo).local?
|
26
|
-
[Procedures::Service::Start.new(:only => feature(:mongo).services)]
|
27
|
-
else
|
28
|
-
[] # there is nothing we can do for remote db
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Checks::Mongo
|
2
|
-
class ToolsInstalled < ForemanMaintain::Check
|
3
|
-
metadata do
|
4
|
-
manual_detection
|
5
|
-
description 'Checks whether the tools for Mongo DB are installed'
|
6
|
-
for_feature :mongo
|
7
|
-
end
|
8
|
-
|
9
|
-
def run
|
10
|
-
if feature(:mongo).server_version =~ /^3\.4/
|
11
|
-
tools_pkg = 'rh-mongodb34-mongo-tools'
|
12
|
-
result = find_package(tools_pkg)
|
13
|
-
else
|
14
|
-
result = execute?('which mongodump')
|
15
|
-
tools_pkg = 'mongodb'
|
16
|
-
end
|
17
|
-
handle_result(result, tools_pkg)
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def handle_result(result, tools_pkg)
|
23
|
-
assert(result,
|
24
|
-
"#{tools_pkg} was not found among installed package.\nThis package is needed to " \
|
25
|
-
'do various operations such as backup, restore and import with Mongo DB.',
|
26
|
-
:next_steps => [
|
27
|
-
Procedures::Packages::Install.new(:packages => [tools_pkg])
|
28
|
-
])
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Checks
|
2
|
-
module Pulpcore
|
3
|
-
class GroupOwnershipCheck < ForemanMaintain::Check
|
4
|
-
metadata do
|
5
|
-
description 'Check the group owner of /var/lib/pulp/content directory'
|
6
|
-
label :group_ownership_check_of_pulp_content
|
7
|
-
manual_detection
|
8
|
-
end
|
9
|
-
|
10
|
-
def run
|
11
|
-
group_id = File.stat('/var/lib/pulp/content/').gid
|
12
|
-
if Etc.getgrgid(group_id).name != 'pulp'
|
13
|
-
fail! "Please run 'foreman-maintain prep-6.10-upgrade' prior to upgrading."
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|