foreman_maintain 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -14,14 +14,14 @@ class Features::DynflowSidekiq < ForemanMaintain::Feature
|
|
|
14
14
|
end
|
|
15
15
|
[
|
|
16
16
|
'/etc/foreman/dynflow',
|
|
17
|
-
service_symlinks
|
|
17
|
+
service_symlinks,
|
|
18
18
|
].flatten
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def services
|
|
22
22
|
service_names.map do |service|
|
|
23
23
|
system_service service, instance_priority(service),
|
|
24
|
-
|
|
24
|
+
:instance_parent_unit => 'dynflow-sidekiq@'
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -10,11 +10,7 @@ module ForemanMaintain
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def services
|
|
13
|
-
|
|
14
|
-
[system_service('foreman', 30, :socket => 'foreman')]
|
|
15
|
-
else
|
|
16
|
-
[system_service('httpd', 30)]
|
|
17
|
-
end
|
|
13
|
+
[system_service('foreman', 30, :socket => 'foreman')]
|
|
18
14
|
end
|
|
19
15
|
|
|
20
16
|
def plugins
|
|
@@ -35,13 +31,13 @@ module ForemanMaintain
|
|
|
35
31
|
'/etc/selinux/targeted/contexts/files/file_contexts.subs',
|
|
36
32
|
'/etc/sysconfig/foreman',
|
|
37
33
|
'/usr/share/ruby/vendor_ruby/puppet/reports/foreman.rb',
|
|
38
|
-
'/var/lib/foreman'
|
|
34
|
+
'/var/lib/foreman',
|
|
39
35
|
]
|
|
40
36
|
end
|
|
41
37
|
|
|
42
38
|
def config_files_to_exclude
|
|
43
39
|
[
|
|
44
|
-
'/var/lib/foreman/public'
|
|
40
|
+
'/var/lib/foreman/public',
|
|
45
41
|
]
|
|
46
42
|
end
|
|
47
43
|
|
|
@@ -40,14 +40,14 @@ class Features::ForemanTasks < ForemanMaintain::Feature
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
def backup_tasks(state)
|
|
44
|
-
backup_table('dynflow_execution_plans', state, 'uuid'
|
|
45
|
-
backup_table('dynflow_steps', state
|
|
46
|
-
backup_table('dynflow_actions', state
|
|
43
|
+
def backup_tasks(state, &block)
|
|
44
|
+
backup_table('dynflow_execution_plans', state, 'uuid', &block)
|
|
45
|
+
backup_table('dynflow_steps', state, &block)
|
|
46
|
+
backup_table('dynflow_actions', state, &block)
|
|
47
47
|
|
|
48
48
|
yield('Backup Tasks [running]')
|
|
49
49
|
export_csv("SELECT * FROM foreman_tasks_tasks WHERE #{condition(state)}",
|
|
50
|
-
|
|
50
|
+
'foreman_tasks_tasks.csv', state)
|
|
51
51
|
yield('Backup Tasks [DONE]')
|
|
52
52
|
@backup_dir = nil
|
|
53
53
|
end
|
|
@@ -106,9 +106,10 @@ class Features::ForemanTasks < ForemanMaintain::Feature
|
|
|
106
106
|
def condition(state)
|
|
107
107
|
raise 'Invalid State' unless valid(state)
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
case state
|
|
110
|
+
when :old
|
|
110
111
|
old_tasks_condition
|
|
111
|
-
|
|
112
|
+
when :paused
|
|
112
113
|
paused_tasks_condition
|
|
113
114
|
else
|
|
114
115
|
tasks_condition(state)
|
|
@@ -116,11 +117,7 @@ class Features::ForemanTasks < ForemanMaintain::Feature
|
|
|
116
117
|
end
|
|
117
118
|
|
|
118
119
|
def resume_task_using_hammer
|
|
119
|
-
|
|
120
|
-
feature(:hammer).run('task resume --search "" --fields="Total tasks resumed"')
|
|
121
|
-
else
|
|
122
|
-
feature(:hammer).run('task resume --fields="Total tasks resumed"')
|
|
123
|
-
end
|
|
120
|
+
feature(:hammer).run('task resume --fields="Total tasks resumed"')
|
|
124
121
|
end
|
|
125
122
|
|
|
126
123
|
def fetch_tasks_status(state, spinner)
|
|
@@ -20,7 +20,7 @@ class Features::Hammer < ForemanMaintain::Feature
|
|
|
20
20
|
def config_directories
|
|
21
21
|
[
|
|
22
22
|
'~/.hammer/',
|
|
23
|
-
'/etc/hammer/'
|
|
23
|
+
'/etc/hammer/',
|
|
24
24
|
]
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -122,14 +122,14 @@ class Features::Hammer < ForemanMaintain::Feature
|
|
|
122
122
|
configuration[:foreman][:username] != username
|
|
123
123
|
end
|
|
124
124
|
|
|
125
|
-
def exec_hammer_cmd(cmd, required_json
|
|
125
|
+
def exec_hammer_cmd(cmd, required_json: false)
|
|
126
126
|
response = run(cmd)
|
|
127
127
|
json_str = parse_json(response) if required_json
|
|
128
|
-
json_str
|
|
128
|
+
json_str || response
|
|
129
129
|
end
|
|
130
130
|
|
|
131
131
|
def load_configuration
|
|
132
|
-
config_directories.
|
|
132
|
+
config_directories.reverse_each do |path|
|
|
133
133
|
full_path = File.expand_path path
|
|
134
134
|
next unless File.directory? full_path
|
|
135
135
|
|
|
@@ -66,7 +66,7 @@ class Features::Installer < ForemanMaintain::Feature
|
|
|
66
66
|
[
|
|
67
67
|
'/usr/local/bin/validate_postgresql_connection.sh',
|
|
68
68
|
'/opt/puppetlabs/puppet/cache/foreman_cache_data',
|
|
69
|
-
'/opt/puppetlabs/puppet/cache/pulpcore_cache_data'
|
|
69
|
+
'/opt/puppetlabs/puppet/cache/pulpcore_cache_data',
|
|
70
70
|
]
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -111,14 +111,13 @@ class Features::Installer < ForemanMaintain::Feature
|
|
|
111
111
|
def installer_arguments
|
|
112
112
|
installer_args = ''
|
|
113
113
|
|
|
114
|
-
if feature(:foreman_proxy) &&
|
|
115
|
-
feature(:foreman_proxy).with_content? &&
|
|
114
|
+
if feature(:foreman_proxy)&.with_content? &&
|
|
116
115
|
check_max_version('foreman-installer', '3.4')
|
|
117
116
|
installer_args += ' --disable-system-checks'
|
|
118
117
|
end
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
installer_args += ' --upgrade'
|
|
119
|
+
if !check_min_version('foreman-installer', '2.1') && can_upgrade?
|
|
120
|
+
installer_args += ' --upgrade'
|
|
122
121
|
end
|
|
123
122
|
|
|
124
123
|
installer_args
|
|
@@ -43,7 +43,7 @@ class Features::Instance < ForemanMaintain::Feature
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def foreman_proxy_with_content?
|
|
46
|
-
feature(:foreman_proxy)
|
|
46
|
+
feature(:foreman_proxy)&.with_content? && !feature(:katello)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def downstream
|
|
@@ -72,7 +72,7 @@ class Features::Instance < ForemanMaintain::Feature
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def pulp
|
|
75
|
-
feature(:
|
|
75
|
+
feature(:pulpcore)
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def firewall
|
|
@@ -85,7 +85,7 @@ class Features::Instance < ForemanMaintain::Feature
|
|
|
85
85
|
|
|
86
86
|
private
|
|
87
87
|
|
|
88
|
-
# rubocop:disable Metrics/
|
|
88
|
+
# rubocop:disable Metrics/AbcSize
|
|
89
89
|
def katello_ping
|
|
90
90
|
res = server_connection.get('/katello/api/ping')
|
|
91
91
|
logger.debug('Called /katello/api/ping')
|
|
@@ -95,19 +95,19 @@ class Features::Instance < ForemanMaintain::Feature
|
|
|
95
95
|
result = create_response(false, response['message'] || response['displayMessage'])
|
|
96
96
|
else # valid response
|
|
97
97
|
failing_components = pick_failing_components(response['services'])
|
|
98
|
-
if failing_components.empty? # all okay
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
result = if failing_components.empty? # all okay
|
|
99
|
+
create_response(true, 'Success')
|
|
100
|
+
else # some components not okay
|
|
101
|
+
create_response(false,
|
|
102
|
+
"Some components are failing: #{failing_components.join(', ')}",
|
|
103
|
+
component_services(failing_components))
|
|
104
|
+
end
|
|
105
105
|
end
|
|
106
106
|
result
|
|
107
107
|
rescue StandardError => e # server error, server down
|
|
108
108
|
create_response(false, "Couldn't connect to the server: #{e.message}")
|
|
109
109
|
end
|
|
110
|
-
# rubocop:enable Metrics/
|
|
110
|
+
# rubocop:enable Metrics/AbcSize
|
|
111
111
|
|
|
112
112
|
def foreman_ping
|
|
113
113
|
res = server_connection.get('/apidoc/apipie_checksum')
|
|
@@ -157,13 +157,11 @@ class Features::Instance < ForemanMaintain::Feature
|
|
|
157
157
|
'candlepin_auth' => %w[candlepin candlepin_database],
|
|
158
158
|
'candlepin_events' => %w[candlepin candlepin_database],
|
|
159
159
|
'candlepin' => %w[candlepin candlepin_database],
|
|
160
|
-
'pulp_auth' => %w[pulp2 mongo],
|
|
161
|
-
'pulp' => %w[pulp2 mongo],
|
|
162
160
|
'pulp3' => %w[pulpcore pulpcore_database],
|
|
163
161
|
'pulp3_content' => %w[pulpcore pulpcore_database],
|
|
164
162
|
'foreman_tasks' => %w[foreman_tasks],
|
|
165
163
|
'katello_agent' => %w[katello],
|
|
166
|
-
'katello_events' => %w[katello]
|
|
164
|
+
'katello_events' => %w[katello],
|
|
167
165
|
}
|
|
168
166
|
end
|
|
169
167
|
|
|
@@ -10,7 +10,7 @@ class Features::Katello < ForemanMaintain::Feature
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def data_dirs
|
|
13
|
-
@dirs ||= ['/var/lib/pulp', '/var/lib/
|
|
13
|
+
@dirs ||= ['/var/lib/pulp', '/var/lib/pgsql']
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def current_version
|
|
@@ -18,14 +18,10 @@ class Features::Katello < ForemanMaintain::Feature
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def services
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
system_service('qpidd', 10),
|
|
26
|
-
system_service('qdrouterd', 10)
|
|
27
|
-
]
|
|
28
|
-
end
|
|
21
|
+
[
|
|
22
|
+
system_service('qpidd', 10),
|
|
23
|
+
system_service('qdrouterd', 10),
|
|
24
|
+
]
|
|
29
25
|
end
|
|
30
26
|
|
|
31
27
|
# rubocop:disable Metrics/MethodLength
|
|
@@ -43,7 +39,7 @@ class Features::Katello < ForemanMaintain::Feature
|
|
|
43
39
|
'/etc/qpid',
|
|
44
40
|
'/etc/qpid-dispatch',
|
|
45
41
|
'/var/lib/qpidd',
|
|
46
|
-
'/etc/qpid-dispatch'
|
|
42
|
+
'/etc/qpid-dispatch',
|
|
47
43
|
]
|
|
48
44
|
|
|
49
45
|
if installer_scenario_answers['certs']
|
|
@@ -51,7 +47,7 @@ class Features::Katello < ForemanMaintain::Feature
|
|
|
51
47
|
installer_scenario_answers['certs']['server_cert'],
|
|
52
48
|
installer_scenario_answers['certs']['server_key'],
|
|
53
49
|
installer_scenario_answers['certs']['server_cert_req'],
|
|
54
|
-
installer_scenario_answers['certs']['server_ca_cert']
|
|
50
|
+
installer_scenario_answers['certs']['server_ca_cert'],
|
|
55
51
|
].compact
|
|
56
52
|
end
|
|
57
53
|
|
|
@@ -62,7 +58,7 @@ class Features::Katello < ForemanMaintain::Feature
|
|
|
62
58
|
def config_files_exclude_for_online
|
|
63
59
|
[
|
|
64
60
|
'/var/lib/qpidd',
|
|
65
|
-
'/var/lib/candlepin/activemq-artemis'
|
|
61
|
+
'/var/lib/candlepin/activemq-artemis',
|
|
66
62
|
]
|
|
67
63
|
end
|
|
68
64
|
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
require 'foreman_maintain/utils/service/systemd'
|
|
2
2
|
|
|
3
3
|
class Features::Pulpcore < ForemanMaintain::Feature
|
|
4
|
+
include ForemanMaintain::Concerns::PulpCommon
|
|
5
|
+
|
|
4
6
|
metadata do
|
|
5
7
|
label :pulpcore
|
|
6
|
-
|
|
7
|
-
confine do
|
|
8
|
-
ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).enabled?
|
|
9
|
-
end
|
|
10
8
|
end
|
|
11
9
|
|
|
12
10
|
def services
|
|
13
11
|
redis_services = feature(:redis) ? feature(:redis).services : []
|
|
14
12
|
|
|
15
13
|
self.class.pulpcore_common_services + configured_workers +
|
|
16
|
-
redis_services
|
|
14
|
+
redis_services
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
def configured_workers
|
|
@@ -25,39 +23,17 @@ class Features::Pulpcore < ForemanMaintain::Feature
|
|
|
25
23
|
end
|
|
26
24
|
end
|
|
27
25
|
|
|
28
|
-
def self.pulpcore_migration_services
|
|
29
|
-
pulpcore_common_services + [
|
|
30
|
-
ForemanMaintain::Utils.system_service('pulpcore-worker@1', 20),
|
|
31
|
-
ForemanMaintain::Utils.system_service('pulpcore-worker@2', 20),
|
|
32
|
-
ForemanMaintain::Utils.system_service('pulpcore-worker@3', 20),
|
|
33
|
-
ForemanMaintain::Utils.system_service('pulpcore-worker@4', 20)
|
|
34
|
-
]
|
|
35
|
-
end
|
|
36
|
-
|
|
37
26
|
def config_files
|
|
38
27
|
[
|
|
39
28
|
'/etc/pulp/settings.py',
|
|
40
|
-
'/etc/pulp/certs/database_fields.symmetric.key'
|
|
29
|
+
'/etc/pulp/certs/database_fields.symmetric.key',
|
|
41
30
|
]
|
|
42
31
|
end
|
|
43
32
|
|
|
44
33
|
def self.pulpcore_common_services
|
|
45
|
-
|
|
34
|
+
[
|
|
46
35
|
ForemanMaintain::Utils.system_service('pulpcore-api', 10, :socket => 'pulpcore-api'),
|
|
47
|
-
ForemanMaintain::Utils.system_service('pulpcore-content', 10, :socket => 'pulpcore-content')
|
|
36
|
+
ForemanMaintain::Utils.system_service('pulpcore-content', 10, :socket => 'pulpcore-content'),
|
|
48
37
|
]
|
|
49
|
-
common_services + pulpcore_resource_manager_service
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def self.pulpcore_resource_manager_service
|
|
53
|
-
# The pulpcore_resource_manager is only required on 3.14+
|
|
54
|
-
# if the old tasking system is being used
|
|
55
|
-
# The foreman-installer does not create unit file for this service,
|
|
56
|
-
# if the new tasking system is being used
|
|
57
|
-
if feature(:service).unit_file_available?('pulpcore-resource-manager.service')
|
|
58
|
-
return [ForemanMaintain::Utils.system_service('pulpcore-resource-manager', 10)]
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
[]
|
|
62
38
|
end
|
|
63
39
|
end
|
|
@@ -20,12 +20,13 @@ class Features::PulpcoreDatabase < ForemanMaintain::Feature
|
|
|
20
20
|
def services
|
|
21
21
|
[
|
|
22
22
|
system_service('postgresql', 10, :component => 'pulpcore',
|
|
23
|
-
:db_feature => feature(:pulpcore_database))
|
|
23
|
+
:db_feature => feature(:pulpcore_database)),
|
|
24
24
|
]
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
private
|
|
28
28
|
|
|
29
|
+
# rubocop:disable Metrics/AbcSize
|
|
29
30
|
def load_configuration
|
|
30
31
|
full_config = File.read(PULPCORE_DB_CONFIG).split(/[\s,'":]/).reject(&:empty?)
|
|
31
32
|
|
|
@@ -38,4 +39,5 @@ class Features::PulpcoreDatabase < ForemanMaintain::Feature
|
|
|
38
39
|
@configuration['password'] = full_config[full_config.index('PASSWORD') + 1]
|
|
39
40
|
@configuration
|
|
40
41
|
end
|
|
42
|
+
# rubocop:enable Metrics/AbcSize
|
|
41
43
|
end
|
|
@@ -15,7 +15,7 @@ class Features::PuppetServer < ForemanMaintain::Feature
|
|
|
15
15
|
'/var/lib/puppet/ssl',
|
|
16
16
|
'/var/lib/puppet',
|
|
17
17
|
'/usr/share/ruby/vendor_ruby/puppet/reports/foreman.rb',
|
|
18
|
-
'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/reports/foreman.rb'
|
|
18
|
+
'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/reports/foreman.rb',
|
|
19
19
|
]
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -13,28 +13,12 @@ class Features::Redis < ForemanMaintain::Feature
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def config_files
|
|
16
|
-
%w[redis redis.conf].map { |config| File.join(
|
|
16
|
+
%w[redis redis.conf].map { |config| File.join('/etc', config) }
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
class << self
|
|
20
|
-
SCL_NAME = 'rh-redis5'.freeze
|
|
21
|
-
|
|
22
|
-
def etc_prefix
|
|
23
|
-
if el7?
|
|
24
|
-
"/etc/opt/rh/#{SCL_NAME}"
|
|
25
|
-
else
|
|
26
|
-
'/etc'
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def scl_prefix
|
|
31
|
-
if el7?
|
|
32
|
-
"#{SCL_NAME}-"
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
20
|
def service_name
|
|
37
|
-
|
|
21
|
+
'redis'
|
|
38
22
|
end
|
|
39
23
|
end
|
|
40
24
|
end
|
|
@@ -8,16 +8,11 @@ class Features::Service < ForemanMaintain::Feature
|
|
|
8
8
|
# { :only => ["httpd"] }
|
|
9
9
|
# { :exclude => ["pulp-workers", "tomcat"] }
|
|
10
10
|
# { :include => ["crond"] }
|
|
11
|
-
|
|
12
|
-
use_katello_service(action, options)
|
|
13
|
-
else
|
|
14
|
-
use_system_service(action, options, spinner)
|
|
15
|
-
end
|
|
11
|
+
use_system_service(action, options, spinner)
|
|
16
12
|
end
|
|
17
13
|
|
|
18
14
|
def existing_services
|
|
19
|
-
ForemanMaintain.available_features.
|
|
20
|
-
flatten(1).
|
|
15
|
+
ForemanMaintain.available_features.flat_map(&:services).
|
|
21
16
|
sort.
|
|
22
17
|
inject([]) do |pool, service| # uniq(&:to_s) for ruby 1.8.7
|
|
23
18
|
pool.last.nil? || !pool.last.matches?(service) ? pool << service : pool
|
|
@@ -130,16 +125,15 @@ class Features::Service < ForemanMaintain::Feature
|
|
|
130
125
|
service_list + socket_list
|
|
131
126
|
end
|
|
132
127
|
|
|
133
|
-
# rubocop:disable Metrics/AbcSize
|
|
134
128
|
def filter_services(service_list, options, action)
|
|
135
|
-
if options[:only]
|
|
129
|
+
if options[:only]&.any?
|
|
136
130
|
service_list = service_list.select do |service|
|
|
137
131
|
options[:only].any? { |opt| service.matches?(opt) }
|
|
138
132
|
end
|
|
139
133
|
service_list = include_unregistered_services(service_list, options[:only])
|
|
140
134
|
end
|
|
141
135
|
|
|
142
|
-
if options[:exclude]
|
|
136
|
+
if options[:exclude]&.any?
|
|
143
137
|
service_list = service_list.reject { |service| options[:exclude].include?(service.name) }
|
|
144
138
|
end
|
|
145
139
|
|
|
@@ -147,7 +141,6 @@ class Features::Service < ForemanMaintain::Feature
|
|
|
147
141
|
service_list = filter_disabled_services!(action, service_list)
|
|
148
142
|
service_list.group_by(&:priority).to_h
|
|
149
143
|
end
|
|
150
|
-
# rubocop:enable Metrics/AbcSize
|
|
151
144
|
|
|
152
145
|
def include_unregistered_services(service_list, services_filter)
|
|
153
146
|
return service_list unless services_filter
|
|
@@ -183,44 +176,7 @@ class Features::Service < ForemanMaintain::Feature
|
|
|
183
176
|
end
|
|
184
177
|
end
|
|
185
178
|
|
|
186
|
-
def use_katello_service(action, options)
|
|
187
|
-
if %w[enable disable].include?(action)
|
|
188
|
-
raise 'Service enable and disable are only supported in Satellite 6.3+'
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
command = "katello-service #{action} "
|
|
192
|
-
|
|
193
|
-
# katello-service in 6.1 does not support --only
|
|
194
|
-
if feature(:instance).downstream.less_than_version?('6.2')
|
|
195
|
-
excluded_services = exclude_services_only(options)
|
|
196
|
-
command += "--exclude #{excluded_services.join(',')}" if excluded_services.any?
|
|
197
|
-
else
|
|
198
|
-
command += katello_service_filters(options)
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
run_katello_service(command)
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
def run_katello_service(command)
|
|
205
|
-
puts "Services are handled by katello-service in Satellite versions 6.2 and earlier. \n" \
|
|
206
|
-
"Flags --brief or --failing will be ignored if present. \n"\
|
|
207
|
-
"Similarly, services that are not listed by katello-service will get ignored. \n"\
|
|
208
|
-
"Redirecting to: \n#{command}\n"
|
|
209
|
-
puts execute(command)
|
|
210
|
-
end
|
|
211
|
-
|
|
212
179
|
def exclude_services_only(options)
|
|
213
180
|
existing_services - filtered_services(options)
|
|
214
181
|
end
|
|
215
|
-
|
|
216
|
-
def katello_service_filters(options)
|
|
217
|
-
filters = ''
|
|
218
|
-
if options[:exclude] && options[:exclude].any?
|
|
219
|
-
filters += "--exclude #{options[:exclude].join(',')}"
|
|
220
|
-
end
|
|
221
|
-
if options[:only] && options[:only].any?
|
|
222
|
-
filters += "--only #{options[:only].join(',')}"
|
|
223
|
-
end
|
|
224
|
-
filters
|
|
225
|
-
end
|
|
226
182
|
end
|
|
@@ -48,12 +48,12 @@ class Features::SyncPlans < ForemanMaintain::Feature
|
|
|
48
48
|
if @data[:enabled] && key_empty?(:disabled)
|
|
49
49
|
[
|
|
50
50
|
'sync plans: enabled',
|
|
51
|
-
mode_on ? [Procedures::SyncPlans::Disable.new] : []
|
|
51
|
+
mode_on ? [Procedures::SyncPlans::Disable.new] : [],
|
|
52
52
|
]
|
|
53
53
|
else
|
|
54
54
|
[
|
|
55
55
|
'sync plans: disabled',
|
|
56
|
-
mode_on ? [] : [Procedures::SyncPlans::Enable.new]
|
|
56
|
+
mode_on ? [] : [Procedures::SyncPlans::Enable.new],
|
|
57
57
|
]
|
|
58
58
|
end
|
|
59
59
|
end
|
data/definitions/features/tar.rb
CHANGED
|
@@ -29,13 +29,13 @@ class Features::Tar < ForemanMaintain::Feature
|
|
|
29
29
|
def validate_volume_size(size)
|
|
30
30
|
if size.nil? || size !~ /^\d+[bBcGKkMPTw]?$/
|
|
31
31
|
raise ForemanMaintain::Error::Validation,
|
|
32
|
-
|
|
32
|
+
"Please specify size according to 'tar --tape-length' format."
|
|
33
33
|
end
|
|
34
34
|
true
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
38
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
|
38
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
|
39
39
|
def tar_command(options)
|
|
40
40
|
volume_size = options.fetch(:volume_size, nil)
|
|
41
41
|
absolute_names = options.fetch(:absolute_names, nil)
|
|
@@ -43,6 +43,7 @@ class Features::Tar < ForemanMaintain::Feature
|
|
|
43
43
|
|
|
44
44
|
tar_command = ['tar']
|
|
45
45
|
tar_command << '--selinux'
|
|
46
|
+
tar_command << '--no-check-device'
|
|
46
47
|
tar_command << "--#{options.fetch(:command, 'create')}"
|
|
47
48
|
tar_command << "--file=#{options.fetch(:archive)}"
|
|
48
49
|
|
|
@@ -81,7 +82,7 @@ class Features::Tar < ForemanMaintain::Feature
|
|
|
81
82
|
tar_command.join(' ')
|
|
82
83
|
end
|
|
83
84
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
84
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
85
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
|
85
86
|
|
|
86
87
|
private
|
|
87
88
|
|
|
@@ -14,14 +14,13 @@ module Procedures::Backup
|
|
|
14
14
|
|
|
15
15
|
param :backup_dir, 'Directory where to backup to', :required => true
|
|
16
16
|
param :proxy_features, 'List of proxy features to backup (default: all)',
|
|
17
|
-
|
|
17
|
+
:array => true, :default => ['all']
|
|
18
18
|
param :ignore_changed_files, 'Should packing tar ignore changed files',
|
|
19
|
-
|
|
19
|
+
:flag => true, :default => false
|
|
20
20
|
param :online_backup, 'The config files are being prepared for an online backup',
|
|
21
|
-
|
|
21
|
+
:flag => true, :default => false
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
# rubocop:disable Metrics/MethodLength
|
|
25
24
|
def run
|
|
26
25
|
logger.debug("Invoking tar from #{FileUtils.pwd}")
|
|
27
26
|
tar_cmd = tar_command
|
|
@@ -63,9 +62,11 @@ module Procedures::Backup
|
|
|
63
62
|
def available_features_config
|
|
64
63
|
configs = []
|
|
65
64
|
exclude_configs = []
|
|
65
|
+
proxy_scenarios = [:foreman_proxy, :capsule]
|
|
66
|
+
|
|
66
67
|
ForemanMaintain.available_features.each do |feature|
|
|
67
68
|
# exclude proxy as it has special handling later
|
|
68
|
-
next if
|
|
69
|
+
next if proxy_scenarios.include?(feature.label)
|
|
69
70
|
|
|
70
71
|
configs += feature.config_files
|
|
71
72
|
exclude_configs += feature.config_files_to_exclude
|
|
@@ -8,7 +8,6 @@ module Procedures::Backup
|
|
|
8
8
|
param :incremental_dir, 'Changes since specified backup only'
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
# rubocop:disable Metrics/MethodLength
|
|
12
11
|
def run
|
|
13
12
|
puts "Creating backup folder #{@backup_dir}"
|
|
14
13
|
|
|
@@ -31,6 +30,5 @@ module Procedures::Backup
|
|
|
31
30
|
end
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
|
-
# rubocop:enable Metrics/MethodLength
|
|
35
33
|
end
|
|
36
34
|
end
|