foreman_maintain 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/checks/foreman/check_puppet_capsules.rb +43 -0
- data/definitions/features/candlepin.rb +1 -2
- data/definitions/features/pulpcore.rb +2 -1
- data/definitions/features/system_repos.rb +8 -0
- data/definitions/procedures/pulpcore/migrate.rb +1 -1
- data/definitions/procedures/puppet/remove_puppet.rb +50 -0
- data/definitions/procedures/puppet/remove_puppet_data.rb +21 -0
- data/definitions/procedures/repositories/backup_enabled_repos.rb +16 -0
- data/definitions/procedures/repositories/enable.rb +13 -0
- data/definitions/scenarios/puppet.rb +21 -0
- data/definitions/scenarios/restore.rb +11 -2
- data/definitions/scenarios/self_upgrade.rb +102 -0
- data/lib/foreman_maintain/cli/plugin_command.rb +14 -0
- data/lib/foreman_maintain/cli/restore_command.rb +5 -1
- data/lib/foreman_maintain/cli/self_upgrade_command.rb +38 -0
- data/lib/foreman_maintain/cli.rb +4 -0
- data/lib/foreman_maintain/concerns/system_helpers.rb +7 -4
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +11 -6
- data/lib/foreman_maintain/concerns/el_repos_manager_common.rb +0 -20
- data/lib/foreman_maintain/repos_manager/dnf_config_manager.rb +0 -13
- data/lib/foreman_maintain/repos_manager/el_common.rb +0 -0
- data/lib/foreman_maintain/repos_manager/yum_config_manager.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcef2fd68b963d566c30be2531b1f09bf71da02eb8cd06e2c280f9d4a6222fc0
|
4
|
+
data.tar.gz: 5a1448015d72fe8e8ae19c73eff430b13387c699689a5dbbdd0b73bbbe49c9f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 348bedd61056cffd63610b9a91d0e8c2a31e3012ec0e41880e05195ae840a61bd14c7d84ea23715cae771272f555b95f05085e4fb1fefc01a4f1a1f84880648d
|
7
|
+
data.tar.gz: 76f1871c0edb9671ec0a45fec272afed10ae05bb9ebab4b92ecc3f7960bb1a7625b9267eba032fb6335fac1e8cc32116047e87dab109fb8745ce37e212399768
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Checks
|
2
|
+
class CheckPuppetCapsules < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
label :puppet_capsules
|
5
|
+
for_feature :foreman_database
|
6
|
+
description 'Check for Puppet capsules from the database'
|
7
|
+
manual_detection
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
puppet_proxies = find_puppet_proxies.reject { |proxy| local_proxy?(proxy['url']) }
|
12
|
+
unless puppet_proxies.empty?
|
13
|
+
names = puppet_proxies.map { |proxy| proxy['name'] }
|
14
|
+
print('You have proxies with Puppet feature enabled, '\
|
15
|
+
"please disable Puppet on all proxies first.\n"\
|
16
|
+
"The following proxies have Puppet feature: #{names.join(', ')}.")
|
17
|
+
abort!
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def find_puppet_proxies
|
22
|
+
feature(:foreman_database).query(puppet_proxies_query)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def local_proxy?(url)
|
28
|
+
URI.parse(url).hostname.casecmp(hostname) == 0
|
29
|
+
end
|
30
|
+
|
31
|
+
def puppet_proxies_query
|
32
|
+
<<-SQL
|
33
|
+
SELECT \"smart_proxies\".*
|
34
|
+
FROM \"smart_proxies\"
|
35
|
+
INNER JOIN \"smart_proxy_features\"
|
36
|
+
ON \"smart_proxies\".\"id\" = \"smart_proxy_features\".\"smart_proxy_id\"
|
37
|
+
INNER JOIN \"features\"
|
38
|
+
ON \"features\".\"id\" = \"smart_proxy_features\".\"feature_id\"
|
39
|
+
WHERE \"features\".\"name\" = 'Puppet'
|
40
|
+
SQL
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -21,6 +21,10 @@ class Features::SystemRepos < ForemanMaintain::Feature
|
|
21
21
|
Hash[*repos.delete!(' ').split("\n")]
|
22
22
|
end
|
23
23
|
|
24
|
+
def enabled_repos_ids
|
25
|
+
trim_repoids(enabled_repos_hash.keys)
|
26
|
+
end
|
27
|
+
|
24
28
|
def upstream_repos_ids
|
25
29
|
trim_repoids(upstream_repos.keys)
|
26
30
|
end
|
@@ -29,6 +33,10 @@ class Features::SystemRepos < ForemanMaintain::Feature
|
|
29
33
|
execute!("yum-config-manager --disable #{repo_ids.join(',')}")
|
30
34
|
end
|
31
35
|
|
36
|
+
def enable_repos(repo_ids)
|
37
|
+
execute!("yum-config-manager --enable #{repo_ids.join(',')}")
|
38
|
+
end
|
39
|
+
|
32
40
|
private
|
33
41
|
|
34
42
|
def trim_repoids(repos)
|
@@ -18,7 +18,7 @@ module Procedures::Pulpcore
|
|
18
18
|
spinner.update('Migrating pulpcore database')
|
19
19
|
execute!('sudo PULP_SETTINGS=/etc/pulp/settings.py '\
|
20
20
|
'DJANGO_SETTINGS_MODULE=pulpcore.app.settings '\
|
21
|
-
'
|
21
|
+
'pulpcore-manager migrate --noinput')
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Procedures::Puppet
|
2
|
+
class RemovePuppet < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Remove Puppet feature'
|
5
|
+
confine do
|
6
|
+
feature(:puppet_server) &&
|
7
|
+
(check_min_version('foreman', '3.0') || check_min_version('foreman-proxy', '3.0'))
|
8
|
+
end
|
9
|
+
advanced_run false
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
services = feature(:foreman_server).services + feature(:dynflow_sidekiq).services
|
14
|
+
Procedures::Service::Stop.new(:only => services)
|
15
|
+
execute!('foreman-rake db:migrate VERSION=0 SCOPE=foreman_puppet') if server_with_puppet?
|
16
|
+
feature(:installer).run(installer_arguments_disabling_puppet.join(' '), :interactive => false)
|
17
|
+
packages_action(:remove, packages_to_remove, :assumeyes => true)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def server_with_puppet?
|
23
|
+
find_package(foreman_plugin_name('foreman_puppet'))
|
24
|
+
end
|
25
|
+
|
26
|
+
def installer_arguments_disabling_puppet
|
27
|
+
answers = feature(:installer).answers
|
28
|
+
|
29
|
+
options = []
|
30
|
+
options << '--no-enable-puppet' if answers.key?('puppet')
|
31
|
+
options << '--no-enable-foreman-plugin-puppet' if answers['foreman::plugin::puppet']
|
32
|
+
options << '--no-enable-foreman-cli-puppet' if answers['foreman::cli::puppet']
|
33
|
+
if answers['foreman_proxy']
|
34
|
+
options << '--foreman-proxy-puppet false'
|
35
|
+
options << '--foreman-proxy-puppetca false'
|
36
|
+
end
|
37
|
+
options << '--foreman-proxy-content-puppet false' if answers.key?('foreman_proxy_content')
|
38
|
+
options
|
39
|
+
end
|
40
|
+
|
41
|
+
def packages_to_remove
|
42
|
+
packages = ['puppetserver']
|
43
|
+
if server_with_puppet?
|
44
|
+
packages << foreman_plugin_name('foreman_puppet')
|
45
|
+
packages << hammer_plugin_name('foreman_puppet')
|
46
|
+
end
|
47
|
+
packages
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Procedures::Puppet
|
2
|
+
class RemovePuppetData < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Remove Puppet data'
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
execute!('foreman-rake purge:puppet')
|
9
|
+
execute!('rm -r ' + files_to_purge.join(' '))
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def files_to_purge
|
15
|
+
%w[
|
16
|
+
/etc/puppetlabs
|
17
|
+
/opt/puppetlabs/server/data
|
18
|
+
]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Procedures::Repositories
|
2
|
+
class BackupEnabledRepos < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
label :backup_enabled_repos
|
5
|
+
description 'Stores enabled repositories in yaml file'
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
enabled_repos_ids = feature(:system_repos).enabled_repos_ids
|
10
|
+
unless enabled_repos_ids.empty?
|
11
|
+
backup_dir = File.expand_path(ForemanMaintain.config.backup_dir)
|
12
|
+
File.write(File.join(backup_dir, 'enabled_repos.yml'), enabled_repos_ids.to_yaml)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Procedures::Repositories
|
2
|
+
class Enable < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
param :repos, 'List of repositories to enable'
|
5
|
+
description 'Enable repositories'
|
6
|
+
end
|
7
|
+
def run
|
8
|
+
with_spinner('Enabling repositories') do
|
9
|
+
feature(:system_repos).enable_repos(@repos)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ForemanMaintain::Scenarios
|
2
|
+
module Puppet
|
3
|
+
class RemovePuppet < ForemanMaintain::Scenario
|
4
|
+
metadata do
|
5
|
+
description 'Remove Puppet feature'
|
6
|
+
tags :puppet_disable
|
7
|
+
label :puppet_disable
|
8
|
+
param :remove_data, 'Purge the Puppet data after disabling plugin'
|
9
|
+
manual_detection
|
10
|
+
end
|
11
|
+
|
12
|
+
def compose
|
13
|
+
if check_min_version('foreman', '3.0') || check_min_version('foreman-proxy', '3.0')
|
14
|
+
add_step(Checks::CheckPuppetCapsules) if server?
|
15
|
+
add_step(Procedures::Puppet::RemovePuppet)
|
16
|
+
add_step(Procedures::Puppet::RemovePuppetData) if context.get(:remove_data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,19 +6,27 @@ module ForemanMaintain::Scenarios
|
|
6
6
|
description 'Restore backup'
|
7
7
|
param :backup_dir, 'Path to backup directory'
|
8
8
|
param :incremental_backup, 'Is the backup incremental?'
|
9
|
+
param :dry_run, 'Check if backup could be restored, without performing the restore'
|
9
10
|
manual_detection
|
10
11
|
end
|
11
12
|
|
12
13
|
# rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
14
|
+
# rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
13
15
|
def compose
|
14
16
|
backup = ForemanMaintain::Utils::Backup.new(context.get(:backup_dir))
|
15
17
|
|
16
18
|
add_steps(find_checks(:root_user))
|
17
19
|
supported_version_check
|
18
20
|
add_steps_with_context(Checks::Restore::ValidateBackup,
|
19
|
-
Procedures::Restore::Confirmation,
|
20
21
|
Checks::Restore::ValidateHostname,
|
21
|
-
Checks::Restore::ValidateInterfaces
|
22
|
+
Checks::Restore::ValidateInterfaces)
|
23
|
+
|
24
|
+
if context.get(:dry_run)
|
25
|
+
self.class.metadata[:run_strategy] = :fail_slow
|
26
|
+
return
|
27
|
+
end
|
28
|
+
|
29
|
+
add_steps_with_context(Procedures::Restore::Confirmation,
|
22
30
|
Procedures::Selinux::SetFileSecurity,
|
23
31
|
Procedures::Restore::Configs)
|
24
32
|
add_step_with_context(Procedures::Crond::Stop) if feature(:cron)
|
@@ -48,6 +56,7 @@ module ForemanMaintain::Scenarios
|
|
48
56
|
add_step_with_context(Procedures::Crond::Start) if feature(:cron)
|
49
57
|
end
|
50
58
|
# rubocop:enable Metrics/MethodLength,Metrics/AbcSize
|
59
|
+
# rubocop:enable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
51
60
|
|
52
61
|
def drop_dbs(backup)
|
53
62
|
if backup.file_map[:candlepin_dump][:present] ||
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module ForemanMaintain::Scenarios
|
2
|
+
class SelfUpgradeBase < ForemanMaintain::Scenario
|
3
|
+
def enabled_system_repos_id
|
4
|
+
feature(:system_repos).enabled_repos_ids
|
5
|
+
end
|
6
|
+
|
7
|
+
def enable_repos(repo_ids = stored_enabled_repos_ids)
|
8
|
+
add_step(Procedures::Repositories::Enable.new(repos: repo_ids))
|
9
|
+
end
|
10
|
+
|
11
|
+
def disable_repos(repo_ids = stored_enabled_repos_ids)
|
12
|
+
add_step(Procedures::Repositories::Disable.new(repos: repo_ids))
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
@target_version ||= context.get(:target_version)
|
17
|
+
end
|
18
|
+
|
19
|
+
def current_version
|
20
|
+
feature(:instance).downstream.current_minor_version
|
21
|
+
end
|
22
|
+
|
23
|
+
def maintenance_repo_id(version)
|
24
|
+
if (repo = ENV['maintenance_repo'])
|
25
|
+
return repo unless repo.empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
maintenance_repo(version)
|
29
|
+
end
|
30
|
+
|
31
|
+
def maintenance_repo(version)
|
32
|
+
if el7?
|
33
|
+
"rhel-#{el_major_version}-server-satellite-maintenance-#{version}-rpms"
|
34
|
+
else
|
35
|
+
"satellite-maintenance-#{version}-for-rhel-#{el_major_version}-x86_64-rpms"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def maintenance_repo_version
|
40
|
+
return '6' if current_version == '6.10'
|
41
|
+
|
42
|
+
current_version
|
43
|
+
end
|
44
|
+
|
45
|
+
def stored_enabled_repos_ids
|
46
|
+
@stored_enabled_repos_ids ||= begin
|
47
|
+
path = File.expand_path('enabled_repos.yml', ForemanMaintain.config.backup_dir)
|
48
|
+
@stored_enabled_repos_ids = File.file?(path) ? YAML.load(File.read(path)) : []
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def all_maintenance_repos
|
53
|
+
repo_regex = if el7?
|
54
|
+
/rhel-\d-server-satellite-maintenance-\d.\d-rpms/
|
55
|
+
else
|
56
|
+
/satellite-maintenance-\d.\d-for-rhel-\d-x86_64-rpms/
|
57
|
+
end
|
58
|
+
stored_enabled_repos_ids.select { |id| !id.match(repo_regex).nil? }
|
59
|
+
end
|
60
|
+
|
61
|
+
def repos_ids_to_reenable
|
62
|
+
repos_ids_to_reenable = stored_enabled_repos_ids - all_maintenance_repos
|
63
|
+
repos_ids_to_reenable << maintenance_repo(maintenance_repo_version)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class SelfUpgrade < SelfUpgradeBase
|
68
|
+
metadata do
|
69
|
+
label :self_upgrade_foreman_maintain
|
70
|
+
description "Enables the specified version's maintenance repository and, "\
|
71
|
+
'updates the foreman-maintain packages'
|
72
|
+
manual_detection
|
73
|
+
end
|
74
|
+
|
75
|
+
def compose
|
76
|
+
if check_min_version('foreman', '2.5') || check_min_version('foreman-proxy', '2.5')
|
77
|
+
pkgs_to_update = %w[satellite-maintain rubygem-foreman_maintain]
|
78
|
+
add_step(Procedures::Repositories::BackupEnabledRepos.new)
|
79
|
+
disable_repos
|
80
|
+
add_step(Procedures::Repositories::Enable.new(repos: [maintenance_repo_id(target_version)]))
|
81
|
+
add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true))
|
82
|
+
enable_repos(repos_ids_to_reenable)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
class SelfUpgradeRescue < SelfUpgradeBase
|
88
|
+
metadata do
|
89
|
+
label :rescue_self_upgrade
|
90
|
+
description 'Disables all version specific maintenance repos and,'\
|
91
|
+
' enables the repositories which were configured prior to self upgrade'
|
92
|
+
manual_detection
|
93
|
+
run_strategy :fail_slow
|
94
|
+
end
|
95
|
+
|
96
|
+
def compose
|
97
|
+
if check_min_version('foreman', '2.5') || check_min_version('foreman-proxy', '2.5')
|
98
|
+
enable_repos(repos_ids_to_reenable)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module ForemanMaintain
|
2
|
+
module Cli
|
3
|
+
class PluginCommand < Base
|
4
|
+
subcommand 'purge-puppet', 'Remove the Puppet feature' do
|
5
|
+
option ['-f', '--remove-all-data'], :flag, 'Purge all the Puppet data',
|
6
|
+
:attribute_name => :remove_data
|
7
|
+
|
8
|
+
def execute
|
9
|
+
run_scenarios_and_exit(Scenarios::Puppet::RemovePuppet.new(:remove_data => remove_data?))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -7,11 +7,15 @@ module ForemanMaintain
|
|
7
7
|
|
8
8
|
option ['-i', '--incremental'], :flag, 'Restore an incremental backup',
|
9
9
|
:attribute_name => :incremental, :completion => { :type => :directory }
|
10
|
+
option ['-n', '--dry-run'], :flag,
|
11
|
+
'Check if backup could be restored, without performing the restore',
|
12
|
+
:attribute_name => :dry_run
|
10
13
|
|
11
14
|
def execute
|
12
15
|
scenario = Scenarios::Restore.new(
|
13
16
|
:backup_dir => @backup_dir,
|
14
|
-
:incremental_backup => @incremental || incremental_backup
|
17
|
+
:incremental_backup => @incremental || incremental_backup?,
|
18
|
+
:dry_run => @dry_run
|
15
19
|
)
|
16
20
|
rescue_scenario = Scenarios::RestoreRescue.new
|
17
21
|
run_scenario(scenario, rescue_scenario)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module ForemanMaintain
|
2
|
+
module Cli
|
3
|
+
class SelfUpgradeCommand < Base
|
4
|
+
option ['--target-version'], 'TARGET_VERSION',\
|
5
|
+
'Major version of the Satellite or Capsule'\
|
6
|
+
', e.g 7.0', :required => true
|
7
|
+
def execute
|
8
|
+
allow_major_version_upgrade_only
|
9
|
+
run_scenario(upgrade_scenario, upgrade_rescue_scenario)
|
10
|
+
end
|
11
|
+
|
12
|
+
def upgrade_scenario
|
13
|
+
Scenarios::SelfUpgrade.new(target_version: target_version)
|
14
|
+
end
|
15
|
+
|
16
|
+
def upgrade_rescue_scenario
|
17
|
+
Scenarios::SelfUpgradeRescue.new(target_version: target_version)
|
18
|
+
end
|
19
|
+
|
20
|
+
def current_downstream_version
|
21
|
+
ForemanMaintain.detector.feature(:instance).downstream.current_version
|
22
|
+
end
|
23
|
+
|
24
|
+
def allow_major_version_upgrade_only
|
25
|
+
begin
|
26
|
+
next_version = Gem::Version.new(target_version)
|
27
|
+
rescue ArgumentError => err
|
28
|
+
raise Error::UsageError, "Invalid version! #{err}"
|
29
|
+
end
|
30
|
+
if current_downstream_version >= next_version
|
31
|
+
message = "The target-version #{target_version} should be "\
|
32
|
+
"greater than existing version #{current_downstream_version}!"
|
33
|
+
raise Error::UsageError, message
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/foreman_maintain/cli.rb
CHANGED
@@ -11,6 +11,8 @@ require 'foreman_maintain/cli/restore_command'
|
|
11
11
|
require 'foreman_maintain/cli/maintenance_mode_command'
|
12
12
|
require 'foreman_maintain/cli/packages_command'
|
13
13
|
require 'foreman_maintain/cli/content_command'
|
14
|
+
require 'foreman_maintain/cli/plugin_command'
|
15
|
+
require 'foreman_maintain/cli/self_upgrade_command'
|
14
16
|
|
15
17
|
module ForemanMaintain
|
16
18
|
module Cli
|
@@ -25,6 +27,8 @@ module ForemanMaintain
|
|
25
27
|
subcommand 'packages', 'Lock/Unlock package protection, install, update', PackagesCommand
|
26
28
|
subcommand 'advanced', 'Advanced tools for server maintenance', AdvancedCommand
|
27
29
|
subcommand 'content', 'Content related commands', ContentCommand
|
30
|
+
subcommand 'plugin', 'Manage optional plugins on your server', PluginCommand
|
31
|
+
subcommand 'self-upgrade', 'Perform major version self upgrade', SelfUpgradeCommand
|
28
32
|
subcommand 'maintenance-mode', 'Control maintenance-mode for application',
|
29
33
|
MaintenanceModeCommand
|
30
34
|
if ForemanMaintain.detector.feature(:satellite) &&
|
@@ -196,15 +196,13 @@ module ForemanMaintain
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def foreman_plugin_name(plugin)
|
199
|
-
if debian?
|
200
|
-
plugin.tr!('_', '-')
|
201
|
-
end
|
199
|
+
plugin = plugin.tr('_', '-') if debian?
|
202
200
|
ruby_prefix + plugin
|
203
201
|
end
|
204
202
|
|
205
203
|
def proxy_plugin_name(plugin)
|
206
204
|
if debian?
|
207
|
-
plugin.tr
|
205
|
+
plugin = plugin.tr('_', '-')
|
208
206
|
proxy_plugin_prefix = 'smart-proxy-'
|
209
207
|
else
|
210
208
|
proxy_plugin_prefix = 'smart_proxy_'
|
@@ -213,6 +211,11 @@ module ForemanMaintain
|
|
213
211
|
ruby_prefix(scl) + proxy_plugin_prefix + plugin
|
214
212
|
end
|
215
213
|
|
214
|
+
def hammer_plugin_name(plugin)
|
215
|
+
plugin = plugin.tr('_', '-') if debian?
|
216
|
+
[hammer_package, plugin].join(debian? ? '-' : '_')
|
217
|
+
end
|
218
|
+
|
216
219
|
def hammer_package
|
217
220
|
hammer_prefix = if debian?
|
218
221
|
'hammer-cli'
|
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: 0.9.
|
4
|
+
version: 0.9.3
|
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: 2021-11-
|
11
|
+
date: 2021-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- definitions/checks/foreman/check_duplicate_permission.rb
|
150
150
|
- definitions/checks/foreman/check_duplicate_roles.rb
|
151
151
|
- definitions/checks/foreman/check_https_proxies.rb
|
152
|
+
- definitions/checks/foreman/check_puppet_capsules.rb
|
152
153
|
- definitions/checks/foreman/db_up.rb
|
153
154
|
- definitions/checks/foreman/facts_names.rb
|
154
155
|
- definitions/checks/foreman/puppet_class_duplicates.rb
|
@@ -286,9 +287,13 @@ files:
|
|
286
287
|
- definitions/procedures/pulp/remove.rb
|
287
288
|
- definitions/procedures/pulpcore/migrate.rb
|
288
289
|
- definitions/procedures/puppet/delete_empty_ca_cert_request_files.rb
|
290
|
+
- definitions/procedures/puppet/remove_puppet.rb
|
291
|
+
- definitions/procedures/puppet/remove_puppet_data.rb
|
289
292
|
- definitions/procedures/refresh_features.rb
|
290
293
|
- definitions/procedures/remote_execution/remove_existing_settingsd.rb
|
294
|
+
- definitions/procedures/repositories/backup_enabled_repos.rb
|
291
295
|
- definitions/procedures/repositories/disable.rb
|
296
|
+
- definitions/procedures/repositories/enable.rb
|
292
297
|
- definitions/procedures/repositories/setup.rb
|
293
298
|
- definitions/procedures/restore/candlepin_dump.rb
|
294
299
|
- definitions/procedures/restore/configs.rb
|
@@ -320,7 +325,9 @@ files:
|
|
320
325
|
- definitions/scenarios/maintenance_mode.rb
|
321
326
|
- definitions/scenarios/packages.rb
|
322
327
|
- definitions/scenarios/prep_6_10_upgrade.rb
|
328
|
+
- definitions/scenarios/puppet.rb
|
323
329
|
- definitions/scenarios/restore.rb
|
330
|
+
- definitions/scenarios/self_upgrade.rb
|
324
331
|
- definitions/scenarios/services.rb
|
325
332
|
- definitions/scenarios/upgrade_to_capsule_6_10.rb
|
326
333
|
- definitions/scenarios/upgrade_to_capsule_6_10_z.rb
|
@@ -367,14 +374,15 @@ files:
|
|
367
374
|
- lib/foreman_maintain/cli/health_command.rb
|
368
375
|
- lib/foreman_maintain/cli/maintenance_mode_command.rb
|
369
376
|
- lib/foreman_maintain/cli/packages_command.rb
|
377
|
+
- lib/foreman_maintain/cli/plugin_command.rb
|
370
378
|
- lib/foreman_maintain/cli/restore_command.rb
|
379
|
+
- lib/foreman_maintain/cli/self_upgrade_command.rb
|
371
380
|
- lib/foreman_maintain/cli/service_command.rb
|
372
381
|
- lib/foreman_maintain/cli/transform_clamp_options.rb
|
373
382
|
- lib/foreman_maintain/cli/upgrade_command.rb
|
374
383
|
- lib/foreman_maintain/concerns/base_database.rb
|
375
384
|
- lib/foreman_maintain/concerns/directory_marker.rb
|
376
385
|
- lib/foreman_maintain/concerns/downstream.rb
|
377
|
-
- lib/foreman_maintain/concerns/el_repos_manager_common.rb
|
378
386
|
- lib/foreman_maintain/concerns/finders.rb
|
379
387
|
- lib/foreman_maintain/concerns/hammer.rb
|
380
388
|
- lib/foreman_maintain/concerns/logger.rb
|
@@ -403,9 +411,6 @@ files:
|
|
403
411
|
- lib/foreman_maintain/procedure.rb
|
404
412
|
- lib/foreman_maintain/reporter.rb
|
405
413
|
- lib/foreman_maintain/reporter/cli_reporter.rb
|
406
|
-
- lib/foreman_maintain/repos_manager/dnf_config_manager.rb
|
407
|
-
- lib/foreman_maintain/repos_manager/el_common.rb
|
408
|
-
- lib/foreman_maintain/repos_manager/yum_config_manager.rb
|
409
414
|
- lib/foreman_maintain/runner.rb
|
410
415
|
- lib/foreman_maintain/runner/execution.rb
|
411
416
|
- lib/foreman_maintain/runner/stored_execution.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module ForemanMaintain
|
2
|
-
module Concerns
|
3
|
-
module ElReposManagerCommon
|
4
|
-
include ForemanMaintain::Concerns::OsFacts
|
5
|
-
|
6
|
-
def package_manager
|
7
|
-
return 'dnf' if el8?
|
8
|
-
|
9
|
-
'yum'
|
10
|
-
end
|
11
|
-
|
12
|
-
def enabled_repos_hash
|
13
|
-
repos = execute("#{package_manager} repolist enabled -d 6 -e 0 2> /dev/null | grep -E 'Repo-id|Repo-baseurl'")
|
14
|
-
return {} if repos.empty?
|
15
|
-
|
16
|
-
Hash[*repos.delete!(' ').split("\n")]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module ForemanMaintain::ReposManager
|
2
|
-
class DnfConfigManager
|
3
|
-
include ForemanMaintain::Concerns::ElReposManagerCommon
|
4
|
-
|
5
|
-
def disable_repos(repo_ids)
|
6
|
-
execute!("dnf config-manager --set-disabled #{repo_ids.join(',')}")
|
7
|
-
end
|
8
|
-
|
9
|
-
def enable_repos(repo_ids)
|
10
|
-
execute!("dnf config-manager --set-enabled #{repo_ids.join(',')}")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
File without changes
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module ForemanMaintain::ReposManager
|
2
|
-
class YumConfigManager
|
3
|
-
include ForemanMaintain::Concerns::ElReposManagerCommon
|
4
|
-
|
5
|
-
def disable_repos(repo_ids)
|
6
|
-
execute!("yum-config-manager --disable #{repo_ids.join(',')}")
|
7
|
-
end
|
8
|
-
|
9
|
-
def enable_repos(repo_ids)
|
10
|
-
execute!("yum-config-manager --enable #{repo_ids.join(',')}")
|
11
|
-
end
|
12
|
-
|
13
|
-
def enabled_repos_hash
|
14
|
-
repos = execute("yum repolist enabled -d 6 -e 0 2> /dev/null | grep -E 'Repo-id|Repo-baseurl'")
|
15
|
-
return {} if repos.empty?
|
16
|
-
|
17
|
-
Hash[*repos.delete!(' ').split("\n")]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|