foreman_maintain 1.0.3 → 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 +10 -4
- data/definitions/features/instance.rb +6 -2
- data/definitions/procedures/repositories/enable.rb +7 -1
- 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/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,18 +45,24 @@ class Checks::CheckHotfixInstalled < ForemanMaintain::Check
|
|
45
45
|
|
46
46
|
def installed_packages
|
47
47
|
packages = []
|
48
|
-
|
49
|
-
query_format = '%{ui_from_repo} %{name}-%{evr}.%{arch}'
|
50
|
-
IO.popen([repoquery_cmd, '-a', '--installed', '--qf', query_format]) do |io|
|
48
|
+
IO.popen(['repoquery', '-a', '--installed', '--qf', query_format]) do |io|
|
51
49
|
io.each do |line|
|
52
50
|
repo, pkg = line.chomp.split
|
53
51
|
next if repo.nil? || pkg.nil?
|
54
|
-
packages << pkg if /satellite|rhscl/ =~ repo
|
52
|
+
packages << pkg if /satellite|rhscl/ =~ repo.downcase
|
55
53
|
end
|
56
54
|
end
|
57
55
|
packages
|
58
56
|
end
|
59
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
|
+
|
60
66
|
def find_hotfix_packages
|
61
67
|
output = execute!('rpm -qa release="*HOTFIX*"').strip
|
62
68
|
return [] if output.empty?
|
@@ -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 : []
|
@@ -2,11 +2,17 @@ module Procedures::Repositories
|
|
2
2
|
class Enable < ForemanMaintain::Procedure
|
3
3
|
metadata do
|
4
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
|
@@ -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
|
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: 2022-
|
11
|
+
date: 2022-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|