foreman_maintain 1.3.0 → 1.3.1
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/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 +2 -2
- 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 +5 -3
- 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 +1 -1
- 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 +1 -1
- data/definitions/scenarios/backup.rb +44 -61
- 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/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 +1 -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 +6 -6
- 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 +2 -3
- data/lib/foreman_maintain/package_manager.rb +1 -3
- 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 +3 -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 +3 -3
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f9e8ef6df753833b37ddddb8923706bfe5f53671e3cf21dd3706227f759d292
|
4
|
+
data.tar.gz: 43d73546fe50ec575de65b7c27b4b05df136ee1ed8076921a3b6548b310dca39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f4d2397cd58b6223f823c599c33695f1d814e24d782f0ee60ef97db953b741e7ad1502ec01f5cf8e24beb472360c16b0434e98461e444a42d3121f49e997a50
|
7
|
+
data.tar.gz: b09a486b783897e76cc6c70de5ce569bc5889c26a798beb01ab861a9d8baae8884e5160517875a91ad0c71e13fb773e66c97dd05c4c00be2a70fe1753aebe62f
|
data/README.md
CHANGED
@@ -50,10 +50,6 @@ Subcommands:
|
|
50
50
|
stop Stop maintenance-mode
|
51
51
|
status Get maintenance-mode status
|
52
52
|
is-enabled Get maintenance-mode status code
|
53
|
-
|
54
|
-
content Content related commands
|
55
|
-
prepare Prepare content for Pulp 3
|
56
|
-
switchover Switch support for certain content from Pulp 2 to Pulp 3
|
57
53
|
```
|
58
54
|
|
59
55
|
### Upgrades
|
data/bin/foreman-maintain
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Ensure we use UTF-8 by defualt, even when run with LC_ALL=C
|
4
4
|
Encoding.default_internal = Encoding.default_external = Encoding::UTF_8
|
5
5
|
|
6
|
-
$LOAD_PATH.unshift(File.expand_path('
|
6
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
7
7
|
|
8
8
|
require 'foreman_maintain'
|
9
9
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'English'
|
3
|
-
project_root = File.expand_path('
|
3
|
+
project_root = File.expand_path('..', __dir__)
|
4
4
|
$LOAD_PATH.unshift(File.join(project_root, 'lib'))
|
5
5
|
CONFIG_FILE = '/etc/foreman-maintain/foreman_maintain.yml'.freeze
|
6
6
|
system('which foreman_maintain > /dev/null 2>&1')
|
@@ -10,14 +10,14 @@ FOREMAN_MAINTAIN = found ? 'foreman-maintain' : File.join(project_root, 'bin/for
|
|
10
10
|
require 'yaml'
|
11
11
|
require 'foreman_maintain/utils/bash'
|
12
12
|
|
13
|
-
# rubocop:disable Lint/
|
13
|
+
# rubocop:disable Lint/SuppressedException
|
14
14
|
def cache_file(config_file)
|
15
15
|
config = YAML.load(File.open(config_file))
|
16
16
|
config.fetch(:completion_cache_file,
|
17
|
-
|
18
|
-
rescue
|
17
|
+
"#{ENV['HOME'] || '/root'}/.cache/foreman_maintain_completion.yml")
|
18
|
+
rescue StandardError
|
19
19
|
end
|
20
|
-
# rubocop:enable Lint/
|
20
|
+
# rubocop:enable Lint/SuppressedException
|
21
21
|
|
22
22
|
config_file = if File.exist?(CONFIG_FILE)
|
23
23
|
CONFIG_FILE
|
@@ -15,7 +15,7 @@ module Checks
|
|
15
15
|
end
|
16
16
|
assert(status, 'Candlepin DB is not responding. ' \
|
17
17
|
'It needs to be up and running to perform the following steps',
|
18
|
-
|
18
|
+
:next_steps => start_pgsql)
|
19
19
|
else
|
20
20
|
feature(:candlepin_database).raise_psql_missing_error
|
21
21
|
end
|
@@ -5,20 +5,13 @@ module Checks::Candlepin
|
|
5
5
|
tags :pre_upgrade
|
6
6
|
|
7
7
|
confine do
|
8
|
-
feature(:candlepin_database)
|
8
|
+
feature(:candlepin_database)&.validate_available_in_cpdb?
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
def run
|
13
13
|
result, result_msg = feature(:candlepin_database).execute_cpdb_validate_cmd
|
14
|
-
|
15
|
-
if feature(:satellite) && feature(:satellite).current_minor_version == '6.2'
|
16
|
-
next_steps.concat(
|
17
|
-
[Procedures::Candlepin::DeleteOrphanedRecordsFromEnvContent.new,
|
18
|
-
Procedures::KnowledgeBaseArticle.new(:doc => 'fix_cpdb_validate_failure')]
|
19
|
-
)
|
20
|
-
end
|
21
|
-
assert(result == 0, result_msg, :next_steps => next_steps)
|
14
|
+
assert(result == 0, result_msg)
|
22
15
|
end
|
23
16
|
end
|
24
17
|
end
|
@@ -4,11 +4,11 @@ class Checks::CheckForNewerPackages < ForemanMaintain::Check
|
|
4
4
|
description 'Check for newer packages and optionally ask for confirmation if not found.'
|
5
5
|
|
6
6
|
param :packages,
|
7
|
-
|
8
|
-
|
7
|
+
'package names to validate',
|
8
|
+
:required => true
|
9
9
|
param :manual_confirmation_version,
|
10
|
-
|
11
|
-
|
10
|
+
'Version of satellite to ask the user if they are on the latest minor release of.',
|
11
|
+
:required => false
|
12
12
|
manual_detection
|
13
13
|
end
|
14
14
|
|
@@ -24,7 +24,7 @@ class Checks::CheckForNewerPackages < ForemanMaintain::Check
|
|
24
24
|
|
25
25
|
def check_for_package_update
|
26
26
|
exit_status, output = ForemanMaintain.package_manager.check_update(packages: @packages,
|
27
|
-
|
27
|
+
with_status: true)
|
28
28
|
packages_with_updates = []
|
29
29
|
if exit_status == 100
|
30
30
|
packages_with_updates = compare_pkg_versions(output).select do |_, result|
|
@@ -22,8 +22,8 @@ class Checks::CheckHotfixInstalled < ForemanMaintain::Check
|
|
22
22
|
installed_pkg_list = installed_packages
|
23
23
|
files_modifications = installed_pkg_list.flat_map { |pkg| modified_files(pkg) }
|
24
24
|
assert(hotfix_rpmlist.empty? && files_modifications.empty?,
|
25
|
-
|
26
|
-
|
25
|
+
warning_message(hotfix_rpmlist, files_modifications),
|
26
|
+
:warn => true)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -49,17 +49,13 @@ class Checks::CheckHotfixInstalled < ForemanMaintain::Check
|
|
49
49
|
io.each do |line|
|
50
50
|
repo, pkg = line.chomp.split
|
51
51
|
next if repo.nil? || pkg.nil?
|
52
|
-
packages << pkg if /satellite
|
52
|
+
packages << pkg if /satellite/.match?(repo.downcase)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
packages
|
56
56
|
end
|
57
57
|
|
58
58
|
def query_format
|
59
|
-
if el7?
|
60
|
-
return '%{ui_from_repo} %{name}-%{evr}.%{arch}'
|
61
|
-
end
|
62
|
-
|
63
59
|
'%{from_repo} %{name}-%{evr}.%{arch}'
|
64
60
|
end
|
65
61
|
|
@@ -31,7 +31,7 @@ module Checks
|
|
31
31
|
puts stats.stdout
|
32
32
|
|
33
33
|
current_downstream_feature = feature(:instance).downstream
|
34
|
-
if current_downstream_feature
|
34
|
+
if current_downstream_feature&.at_least_version?('6.3')
|
35
35
|
assert(success, io_obj.slow_disk_error_msg + warning_message, :warn => true)
|
36
36
|
else
|
37
37
|
assert(success, io_obj.slow_disk_error_msg)
|
@@ -40,7 +40,7 @@ module Checks
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def data_dirs
|
43
|
-
@data_dirs ||= %i[pulpcore_database
|
43
|
+
@data_dirs ||= %i[pulpcore_database foreman_database].inject({}) do |dirs, f|
|
44
44
|
if feature(f) && File.directory?(feature(f).data_dir)
|
45
45
|
dirs[feature(f).label_dashed] = feature(f).data_dir
|
46
46
|
end
|
@@ -50,7 +50,7 @@ module Checks
|
|
50
50
|
|
51
51
|
def pulp_dir
|
52
52
|
@pulp_dir ||= begin
|
53
|
-
pulp_feature = feature(:
|
53
|
+
pulp_feature = feature(:pulpcore)
|
54
54
|
{ pulp_feature.label_dashed => pulp_feature.pulp_data_dir }
|
55
55
|
end
|
56
56
|
end
|
@@ -14,8 +14,8 @@ module Checks
|
|
14
14
|
def run
|
15
15
|
items = find_filter_permissions
|
16
16
|
assert(items.empty?,
|
17
|
-
|
18
|
-
|
17
|
+
error_message(items),
|
18
|
+
:next_steps => Procedures::Foreman::FixCorruptedRoles.new)
|
19
19
|
end
|
20
20
|
|
21
21
|
def error_message(items)
|
@@ -29,7 +29,6 @@ module Checks
|
|
29
29
|
feature(:foreman_database).query(self.class.inconsistent_filter_perms)
|
30
30
|
end
|
31
31
|
|
32
|
-
# rubocop:disable Metrics/MethodLength
|
33
32
|
def self.inconsistent_filter_perms
|
34
33
|
subquery = <<-SQL
|
35
34
|
SELECT filters.id AS filter_id,
|
@@ -65,7 +64,6 @@ module Checks
|
|
65
64
|
OR (first.resource_type != second.resource_type))
|
66
65
|
SQL
|
67
66
|
end
|
68
|
-
# rubocop:enable Metrics/MethodLength
|
69
67
|
end
|
70
68
|
end
|
71
69
|
end
|
@@ -65,7 +65,7 @@ module Checks
|
|
65
65
|
'medium' => { cpu_cores: 8, memory: 32 },
|
66
66
|
'large' => { cpu_cores: 16, memory: 64 },
|
67
67
|
'extra-large' => { cpu_cores: 32, memory: 128 },
|
68
|
-
'extra-extra-large' => { cpu_cores: 48, memory: 256 }
|
68
|
+
'extra-extra-large' => { cpu_cores: 48, memory: 256 },
|
69
69
|
}
|
70
70
|
end
|
71
71
|
|
@@ -15,7 +15,7 @@ module Checks
|
|
15
15
|
end
|
16
16
|
assert(status, 'Foreman DB is not responding. ' \
|
17
17
|
'It needs to be up and running to perform the following steps',
|
18
|
-
|
18
|
+
:next_steps => start_pgsql)
|
19
19
|
else
|
20
20
|
feature(:foreman_database).raise_psql_missing_error
|
21
21
|
end
|
@@ -21,10 +21,10 @@ module Checks
|
|
21
21
|
host_id = result['host_id']
|
22
22
|
count = result['count'].to_i
|
23
23
|
assert(count < max,
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
"Host (ID #{host_id}) has #{count} fact values which is more than #{max}.\n" \
|
25
|
+
'This can cause slow fact processing.',
|
26
|
+
:warn => true,
|
27
|
+
:next_steps => [Procedures::KnowledgeBaseArticle.new(:doc => 'many_fact_values')])
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -11,10 +11,10 @@ module Checks
|
|
11
11
|
def run
|
12
12
|
ids_to_remove = to_remove
|
13
13
|
assert(ids_to_remove.empty?,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
"There are #{ids_to_remove.count} reports with issues that will be removed",
|
15
|
+
:next_steps => Procedures::ForemanOpenscap::InvalidReportAssociations.new(
|
16
|
+
:ids_to_remove => ids_to_remove
|
17
|
+
))
|
18
18
|
end
|
19
19
|
|
20
20
|
def to_remove
|
@@ -14,8 +14,8 @@ module Checks::ForemanProxy
|
|
14
14
|
if non_zero_token_duration? && Dir.exist?(tftp_boot_directory)
|
15
15
|
files = old_files_from_tftp_boot
|
16
16
|
assert(files.empty?,
|
17
|
-
|
18
|
-
|
17
|
+
'There are old initrd and vmlinuz files present in tftp',
|
18
|
+
:next_steps => Procedures::Files::Remove.new(:files => files))
|
19
19
|
else
|
20
20
|
skip "TFTP #{tftp_boot_directory} directory doesn't exist."
|
21
21
|
end
|
@@ -23,8 +23,8 @@ module Checks::ForemanProxy
|
|
23
23
|
|
24
24
|
def old_files_from_tftp_boot
|
25
25
|
Dir.glob("#{tftp_boot_directory}*-{vmlinuz,initrd.img}").map do |file|
|
26
|
-
|
27
|
-
file
|
26
|
+
if !File.directory?(file) && (File.mtime(file) + (token_duration * 60) < Time.now)
|
27
|
+
file
|
28
28
|
end
|
29
29
|
end.compact
|
30
30
|
end
|
@@ -4,8 +4,7 @@ module Checks::ForemanProxy
|
|
4
4
|
description 'Check for verifying syntax for ISP DHCP configurations'
|
5
5
|
tags :default
|
6
6
|
confine do
|
7
|
-
feature(:foreman_proxy) &&
|
8
|
-
feature(:foreman_proxy).features.include?('dhcp') &&
|
7
|
+
feature(:foreman_proxy)&.features&.include?('dhcp') &&
|
9
8
|
feature(:foreman_proxy).dhcp_isc_provider?
|
10
9
|
end
|
11
10
|
end
|
@@ -14,8 +14,8 @@ module Checks::ForemanTasks
|
|
14
14
|
# Check and delete 'all tasks beyond 30 days(paused and stopped)'
|
15
15
|
count_old_tasks = feature(:foreman_tasks).count(:old)
|
16
16
|
assert(count_old_tasks <= 0,
|
17
|
-
|
18
|
-
|
17
|
+
"Found #{count_old_tasks} paused or stopped task(s) older than 30 days",
|
18
|
+
:next_steps => Procedures::ForemanTasks::Delete.new(:state => :old))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -13,8 +13,8 @@ module Checks::ForemanTasks
|
|
13
13
|
# Check and delete 'all tasks in pending state'
|
14
14
|
count_tasks_in_pending_state = feature(:foreman_tasks).count(:pending)
|
15
15
|
assert(count_tasks_in_pending_state <= 0,
|
16
|
-
|
17
|
-
|
16
|
+
"Found #{count_tasks_in_pending_state} pending task(s) which are safe to delete",
|
17
|
+
:next_steps => Procedures::ForemanTasks::Delete.new(:state => :pending))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -13,8 +13,8 @@ module Checks::ForemanTasks
|
|
13
13
|
# Check and delete 'all tasks in planning state'
|
14
14
|
tasks_in_planning_count = feature(:foreman_tasks).count(:planning)
|
15
15
|
assert(tasks_in_planning_count <= 0,
|
16
|
-
|
17
|
-
|
16
|
+
"Found #{tasks_in_planning_count} task(s) in planning state",
|
17
|
+
:next_steps => Procedures::ForemanTasks::Delete.new(:state => :planning))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -11,8 +11,8 @@ module Checks::ForemanTasks
|
|
11
11
|
def run
|
12
12
|
paused_tasks_count = feature(:foreman_tasks).paused_tasks_count()
|
13
13
|
assert(paused_tasks_count == 0,
|
14
|
-
|
15
|
-
|
14
|
+
"There are currently #{paused_tasks_count} paused tasks in the system",
|
15
|
+
:next_steps => next_procedures)
|
16
16
|
end
|
17
17
|
|
18
18
|
def next_procedures
|
@@ -11,12 +11,12 @@ module Checks::ForemanTasks
|
|
11
11
|
def run
|
12
12
|
task_count = feature(:foreman_tasks).running_tasks_count
|
13
13
|
assert(task_count == 0,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
failure_message(task_count),
|
15
|
+
:next_steps =>
|
16
|
+
[Procedures::ForemanTasks::FetchTasksStatus.new(:state => 'running'),
|
17
|
+
Procedures::ForemanTasks::UiInvestigate.new(
|
18
|
+
'search_query' => search_query_for_running_tasks
|
19
|
+
)])
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
@@ -16,8 +16,8 @@ class Checks::OriginalAssets < ForemanMaintain::Check
|
|
16
16
|
end
|
17
17
|
remove_files = Procedures::Files::Remove.new(:files => custom_assets, :assumeyes => true)
|
18
18
|
assert(custom_assets.empty?,
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
"Some assets not owned by #{product_name} were detected on the system.\n" \
|
20
|
+
'Possible conflicting versions can affect operation of the Web UI.',
|
21
|
+
:next_steps => remove_files)
|
22
22
|
end
|
23
23
|
end
|
@@ -18,8 +18,8 @@ class Checks::CheckUpstreamRepository < ForemanMaintain::Check
|
|
18
18
|
with_spinner('Checking for presence of upstream repositories') do
|
19
19
|
enabled_repo_ids = repoids_and_urls.keys
|
20
20
|
assert(enabled_repo_ids.empty?,
|
21
|
-
|
22
|
-
|
21
|
+
"System has upstream #{enabled_repo_ids.join(',')} repositories enabled",
|
22
|
+
:next_steps => Procedures::Repositories::Disable.new(:repos => enabled_repo_ids))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Checks::Restore
|
2
|
+
class ValidatePostgresqlDumpPermissions < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
description 'Validate permissions for PostgreSQL dumps'
|
5
|
+
|
6
|
+
param :backup_dir,
|
7
|
+
'Path to backup directory',
|
8
|
+
:required => true
|
9
|
+
manual_detection
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
backup = ForemanMaintain::Utils::Backup.new(@backup_dir)
|
14
|
+
if feature(:instance).postgresql_local? && backup.online_backup?
|
15
|
+
errors = []
|
16
|
+
[:candlepin_dump, :foreman_dump, :pulpcore_dump].each do |dump|
|
17
|
+
next unless backup.file_map[dump][:present]
|
18
|
+
|
19
|
+
unless system("runuser - postgres -c 'test -r #{backup.file_map[dump][:path]}'")
|
20
|
+
errors << backup.file_map[dump][:path]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
msg = "The 'postgres' user needs read access to the following files:\n"
|
25
|
+
msg << errors.join("\n")
|
26
|
+
assert(errors.empty?, msg)
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -14,7 +14,7 @@ class Checks::ServicesUp < ForemanMaintain::Check
|
|
14
14
|
:wait_for_server_response => true
|
15
15
|
)
|
16
16
|
assert(failed_services.empty?,
|
17
|
-
|
18
|
-
|
17
|
+
'Following services are not running: ' + failed_services.map(&:to_s).join(', '),
|
18
|
+
:next_steps => restart_procedure)
|
19
19
|
end
|
20
20
|
end
|
@@ -14,7 +14,7 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
|
|
14
14
|
def services
|
15
15
|
[
|
16
16
|
system_service('postgresql', 10, :component => 'candlepin',
|
17
|
-
:db_feature => feature(:candlepin_database))
|
17
|
+
:db_feature => feature(:candlepin_database)),
|
18
18
|
]
|
19
19
|
end
|
20
20
|
|
@@ -53,7 +53,6 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
|
|
53
53
|
|
54
54
|
private
|
55
55
|
|
56
|
-
# rubocop:disable Metrics/MethodLength
|
57
56
|
def load_configuration
|
58
57
|
raw_config = File.read(CANDLEPIN_DB_CONFIG)
|
59
58
|
full_config = Hash[raw_config.scan(/(^[^#\n][^=]*)=(.*)/)]
|
@@ -69,10 +68,9 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
|
|
69
68
|
'ssl' => (fetch_extra_param(url, 'ssl') == 'true'),
|
70
69
|
'sslfactory' => fetch_extra_param(url, 'sslfactory'),
|
71
70
|
'driver_class' => full_config['jpa.config.hibernate.connection.driver_class'],
|
72
|
-
'url' => url
|
71
|
+
'url' => url,
|
73
72
|
}
|
74
73
|
end
|
75
|
-
# rubocop:enable Metrics/MethodLength
|
76
74
|
|
77
75
|
def extend_with_db_options
|
78
76
|
db_options = { '-d' => configuration['database'] }
|
@@ -2,9 +2,7 @@ class Features::Cron < ForemanMaintain::Feature
|
|
2
2
|
metadata do
|
3
3
|
label :cron
|
4
4
|
confine do
|
5
|
-
ForemanMaintain.config.manage_crond &&
|
6
|
-
feature(:instance).downstream && feature(:instance).downstream.less_than_version?('6.3')
|
7
|
-
)
|
5
|
+
ForemanMaintain.config.manage_crond && feature(:instance).downstream
|
8
6
|
end
|
9
7
|
end
|
10
8
|
|
@@ -13,12 +11,12 @@ class Features::Cron < ForemanMaintain::Feature
|
|
13
11
|
if cron_service.running?
|
14
12
|
[
|
15
13
|
'cron jobs: running',
|
16
|
-
mode_on ? [Procedures::Service::Stop.new(:only => [cron_service])] : []
|
14
|
+
mode_on ? [Procedures::Service::Stop.new(:only => [cron_service])] : [],
|
17
15
|
]
|
18
16
|
else
|
19
17
|
[
|
20
18
|
'cron jobs: not running',
|
21
|
-
mode_on ? [] : [Procedures::Service::Start.new(:only => [cron_service])]
|
19
|
+
mode_on ? [] : [Procedures::Service::Start.new(:only => [cron_service])],
|
22
20
|
]
|
23
21
|
end
|
24
22
|
end
|
@@ -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
|
|