foreman_maintain 1.0.1 → 1.0.4
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/definitions/checks/check_hotfix_installed.rb +11 -3
- data/definitions/checks/foreman_proxy/check_tftp_storage.rb +5 -5
- data/definitions/checks/pulpcore/group_ownership_check.rb +2 -2
- data/definitions/features/instance.rb +6 -2
- data/definitions/procedures/puppet/remove_puppet.rb +11 -3
- data/definitions/procedures/puppet/remove_puppet_data.rb +3 -1
- data/definitions/procedures/repositories/disable.rb +1 -1
- data/definitions/procedures/repositories/enable.rb +8 -2
- data/definitions/scenarios/puppet.rb +1 -0
- data/definitions/scenarios/self_upgrade.rb +14 -5
- data/definitions/scenarios/upgrade_to_satellite_7_0.rb +1 -0
- data/lib/foreman_maintain/cli/self_upgrade_command.rb +2 -1
- data/lib/foreman_maintain/concerns/downstream.rb +1 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eee1f58199b0dd709acdfd9095292306de60d75d067edac09d28287caf323439
|
4
|
+
data.tar.gz: bd0b37c9668e6db36895a5a13b1568ea2cd171feacb670d5f5c912b9a7e7e7b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c4117234bfaf93217d80f8f076b0187c59bb240fd3f8210867c41422d47c3a033d31c2eb2be61252303fe371ce1ab1c33d6f362576ed5a411d5c4c989b58c45
|
7
|
+
data.tar.gz: 97a10cdf47b6838eef3b7d79bc91849bc7d3f991e090f16d7a6a013b377b3a09e46c5ccd23de64f1520c080f7d1d56397468beb0bffe0a4d901e10c327356488
|
@@ -45,16 +45,24 @@ class Checks::CheckHotfixInstalled < ForemanMaintain::Check
|
|
45
45
|
|
46
46
|
def installed_packages
|
47
47
|
packages = []
|
48
|
-
|
49
|
-
IO.popen([repoquery_cmd, '-a', '--installed', '--qf', '%{ui_from_repo} %{nvra}']) do |io|
|
48
|
+
IO.popen(['repoquery', '-a', '--installed', '--qf', query_format]) do |io|
|
50
49
|
io.each do |line|
|
51
50
|
repo, pkg = line.chomp.split
|
52
|
-
|
51
|
+
next if repo.nil? || pkg.nil?
|
52
|
+
packages << pkg if /satellite|rhscl/ =~ repo.downcase
|
53
53
|
end
|
54
54
|
end
|
55
55
|
packages
|
56
56
|
end
|
57
57
|
|
58
|
+
def query_format
|
59
|
+
if el7?
|
60
|
+
return '%{ui_from_repo} %{name}-%{evr}.%{arch}'
|
61
|
+
end
|
62
|
+
|
63
|
+
'%{from_repo} %{name}-%{evr}.%{arch}'
|
64
|
+
end
|
65
|
+
|
58
66
|
def find_hotfix_packages
|
59
67
|
output = execute!('rpm -qa release="*HOTFIX*"').strip
|
60
68
|
return [] if output.empty?
|
@@ -6,12 +6,12 @@ module Checks::ForemanProxy
|
|
6
6
|
tags :default
|
7
7
|
confine do
|
8
8
|
feature(:satellite) && feature(:foreman_proxy) &&
|
9
|
-
feature(:foreman_proxy).features.include?('tftp')
|
9
|
+
feature(:foreman_proxy).features.include?('tftp')
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def run
|
14
|
-
if Dir.exist?(tftp_boot_directory)
|
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
17
|
'There are old initrd and vmlinuz files present in tftp',
|
@@ -29,7 +29,7 @@ module Checks::ForemanProxy
|
|
29
29
|
end.compact
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def non_zero_token_duration?
|
33
33
|
lookup_token_duration != 0
|
34
34
|
end
|
35
35
|
|
@@ -38,10 +38,10 @@ module Checks::ForemanProxy
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def token_duration
|
41
|
-
@token_duration ||=
|
41
|
+
@token_duration ||= lookup_token_duration
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
44
|
+
def lookup_token_duration
|
45
45
|
data = feature(:foreman_database). \
|
46
46
|
query("select s.value, s.default from settings s \
|
47
47
|
where category IN ('Setting::Provisioning','Setting') \
|
@@ -2,13 +2,13 @@ module Checks
|
|
2
2
|
module Pulpcore
|
3
3
|
class GroupOwnershipCheck < ForemanMaintain::Check
|
4
4
|
metadata do
|
5
|
-
description 'Check the group owner of /var/lib/pulp directory'
|
5
|
+
description 'Check the group owner of /var/lib/pulp/content directory'
|
6
6
|
label :group_ownership_check_of_pulp_content
|
7
7
|
manual_detection
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
group_id = File.stat('/var/lib/pulp/').gid
|
11
|
+
group_id = File.stat('/var/lib/pulp/content/').gid
|
12
12
|
if Etc.getgrgid(group_id).name != 'pulp'
|
13
13
|
fail! "Please run 'foreman-maintain prep-6.10-upgrade' prior to upgrading."
|
14
14
|
end
|
@@ -142,11 +142,15 @@ class Features::Instance < ForemanMaintain::Feature
|
|
142
142
|
def component_features_map
|
143
143
|
{
|
144
144
|
'candlepin_auth' => %w[candlepin candlepin_database],
|
145
|
+
'candlepin_events' => %w[candlepin candlepin_database],
|
145
146
|
'candlepin' => %w[candlepin candlepin_database],
|
146
147
|
'pulp_auth' => %w[pulp2 mongo],
|
147
148
|
'pulp' => %w[pulp2 mongo],
|
148
149
|
'pulp3' => %w[pulpcore pulpcore_database],
|
149
|
-
'
|
150
|
+
'pulp3_content' => %w[pulpcore pulpcore_database],
|
151
|
+
'foreman_tasks' => %w[foreman_tasks],
|
152
|
+
'katello_agent' => %w[katello],
|
153
|
+
'katello_events' => %w[katello]
|
150
154
|
}
|
151
155
|
end
|
152
156
|
|
@@ -154,7 +158,7 @@ class Features::Instance < ForemanMaintain::Feature
|
|
154
158
|
components = Array(components)
|
155
159
|
cf_map = component_features_map
|
156
160
|
# map ping components to features
|
157
|
-
features = components.map { |component| cf_map[component] }.flatten.uniq
|
161
|
+
features = components.map { |component| cf_map[component] }.flatten.uniq.compact
|
158
162
|
# map features to existing services
|
159
163
|
services_of_features = features.map do |name|
|
160
164
|
feature(name.to_sym) ? feature(name.to_sym).services : []
|
@@ -10,15 +10,23 @@ module Procedures::Puppet
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def run
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
stop_applicable_services
|
14
|
+
if server_with_puppet? && feature(:foreman_server)
|
15
|
+
execute!('foreman-rake db:migrate VERSION=0 SCOPE=foreman_puppet')
|
16
|
+
end
|
16
17
|
feature(:installer).run(installer_arguments_disabling_puppet.join(' '), :interactive => false)
|
17
18
|
packages_action(:remove, packages_to_remove, :assumeyes => true)
|
18
19
|
end
|
19
20
|
|
20
21
|
private
|
21
22
|
|
23
|
+
def stop_applicable_services
|
24
|
+
services = []
|
25
|
+
services = feature(:foreman_server).services if feature(:foreman_server)
|
26
|
+
services << feature(:dynflow_sidekiq).services if feature(:dynflow_sidekiq)
|
27
|
+
Procedures::Service::Stop.new(:only => services) unless services.empty?
|
28
|
+
end
|
29
|
+
|
22
30
|
def server_with_puppet?
|
23
31
|
find_package(foreman_plugin_name('foreman_puppet'))
|
24
32
|
end
|
@@ -1,12 +1,18 @@
|
|
1
1
|
module Procedures::Repositories
|
2
2
|
class Enable < ForemanMaintain::Procedure
|
3
3
|
metadata do
|
4
|
-
param :repos, '
|
4
|
+
param :repos, 'Array of repositories to enable'
|
5
|
+
param :use_rhsm, 'Use RHSM to enable repository',
|
6
|
+
:flag => true, :default => false
|
5
7
|
description 'Enable repositories'
|
6
8
|
end
|
7
9
|
def run
|
8
10
|
with_spinner('Enabling repositories') do
|
9
|
-
|
11
|
+
if @use_rhsm
|
12
|
+
repository_manager.rhsm_enable_repos(@repos)
|
13
|
+
else
|
14
|
+
repository_manager.enable_repos(@repos)
|
15
|
+
end
|
10
16
|
end
|
11
17
|
end
|
12
18
|
end
|
@@ -14,6 +14,7 @@ module ForemanMaintain::Scenarios
|
|
14
14
|
add_step(Checks::CheckPuppetCapsules) if server?
|
15
15
|
add_step(Procedures::Puppet::RemovePuppet)
|
16
16
|
add_step(Procedures::Puppet::RemovePuppetData) if context.get(:remove_data)
|
17
|
+
add_step(Procedures::Service::Restart)
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
@@ -62,13 +62,21 @@ module ForemanMaintain::Scenarios
|
|
62
62
|
repos_ids_to_reenable = stored_enabled_repos_ids - all_maintenance_repos
|
63
63
|
repos_ids_to_reenable << maintenance_repo(maintenance_repo_version)
|
64
64
|
end
|
65
|
+
|
66
|
+
def use_rhsm?
|
67
|
+
if (repo = ENV['maintenance_repo'])
|
68
|
+
return false unless repo.empty?
|
69
|
+
end
|
70
|
+
|
71
|
+
true
|
72
|
+
end
|
65
73
|
end
|
66
74
|
|
67
75
|
class SelfUpgrade < SelfUpgradeBase
|
68
76
|
metadata do
|
69
77
|
label :self_upgrade_foreman_maintain
|
70
|
-
description "Enables the specified version's maintenance repository and,
|
71
|
-
|
78
|
+
description "Enables the specified version's maintenance repository and,"\
|
79
|
+
"\nupdates the satellite-maintain packages"
|
72
80
|
manual_detection
|
73
81
|
end
|
74
82
|
|
@@ -77,7 +85,8 @@ module ForemanMaintain::Scenarios
|
|
77
85
|
pkgs_to_update = %w[satellite-maintain rubygem-foreman_maintain]
|
78
86
|
add_step(Procedures::Repositories::BackupEnabledRepos.new)
|
79
87
|
disable_repos
|
80
|
-
add_step(Procedures::Repositories::Enable.new(repos: [maintenance_repo_id(target_version)]
|
88
|
+
add_step(Procedures::Repositories::Enable.new(repos: [maintenance_repo_id(target_version)],
|
89
|
+
use_rhsm: use_rhsm?))
|
81
90
|
add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true))
|
82
91
|
enable_repos(repos_ids_to_reenable)
|
83
92
|
end
|
@@ -87,8 +96,8 @@ module ForemanMaintain::Scenarios
|
|
87
96
|
class SelfUpgradeRescue < SelfUpgradeBase
|
88
97
|
metadata do
|
89
98
|
label :rescue_self_upgrade
|
90
|
-
description 'Disables all version specific maintenance
|
91
|
-
|
99
|
+
description 'Disables all version specific maintenance repositories and,'\
|
100
|
+
"\nenables the repositories which were configured prior to self upgrade"
|
92
101
|
manual_detection
|
93
102
|
run_strategy :fail_slow
|
94
103
|
end
|
@@ -29,7 +29,8 @@ module ForemanMaintain
|
|
29
29
|
end
|
30
30
|
if current_downstream_version >= next_version
|
31
31
|
message = "The target-version #{target_version} should be "\
|
32
|
-
"greater than existing version #{current_downstream_version}
|
32
|
+
"greater than existing version #{current_downstream_version},"\
|
33
|
+
"\nand self-upgrade should be used for major version upgrades only!"
|
33
34
|
raise Error::UsageError, message
|
34
35
|
end
|
35
36
|
end
|
@@ -30,7 +30,7 @@ module ForemanMaintain
|
|
30
30
|
execute!(%(subscription-manager register #{org_options}\
|
31
31
|
--activationkey #{shellescape(activation_key)} --force))
|
32
32
|
else
|
33
|
-
repository_manager.rhsm_disable_repos('*')
|
33
|
+
repository_manager.rhsm_disable_repos(['*'])
|
34
34
|
repository_manager.rhsm_enable_repos(rh_repos(version))
|
35
35
|
end
|
36
36
|
end
|
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.0.
|
4
|
+
version: 1.0.4
|
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:
|
11
|
+
date: 2022-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|