foreman_maintain 0.8.17 → 0.8.18
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 455f573cec6321cd19ca9116d9f1482cd16f63406c460646fe20dc10ec84952d
|
4
|
+
data.tar.gz: ac42424b2f6aa0b6cf4133300c131333a46e7fa145bb814bb43884f8f9edbff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7675e2558fc4703674f70b001a67e2ec492cb1188e36a2a31d0f0cbd86d4ebb9272f5a35107be8e516de015c97663c39f3bd21407197cee896fa389cda26033
|
7
|
+
data.tar.gz: 7904e234c90ffef03834dd5fa695a96b7b315ccc69ae9bddeb00f4562babd15976886b6efcba7feac5380051c7fc0cec7f25558a46aedec19a9425434e4e757b
|
@@ -12,10 +12,7 @@ class Checks::CheckForNewerPackages < ForemanMaintain::Check
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def run
|
15
|
-
|
16
|
-
with_status: true)
|
17
|
-
assert(exit_status == 0, 'An update is available for one of these packages: '\
|
18
|
-
"#{@packages.join(',')}. Please update before proceeding.")
|
15
|
+
check_for_package_update
|
19
16
|
if @manual_confirmation_version
|
20
17
|
question = 'Confirm that you are running the latest minor release of Satellite '\
|
21
18
|
"#{@manual_confirmation_version}"
|
@@ -23,4 +20,45 @@ class Checks::CheckForNewerPackages < ForemanMaintain::Check
|
|
23
20
|
abort! if answer != :yes
|
24
21
|
end
|
25
22
|
end
|
23
|
+
|
24
|
+
def check_for_package_update
|
25
|
+
exit_status, output = ForemanMaintain.package_manager.check_update(packages: @packages,
|
26
|
+
with_status: true)
|
27
|
+
packages_with_updates = []
|
28
|
+
if exit_status == 100
|
29
|
+
packages_with_updates = compare_pkg_versions(output).select do |_, result|
|
30
|
+
result == -1
|
31
|
+
end.keys
|
32
|
+
end
|
33
|
+
|
34
|
+
unless packages_with_updates.empty?
|
35
|
+
failure_message = 'An update is available for package(s): '\
|
36
|
+
"#{packages_with_updates.join(',')}. Please update before proceeding!"
|
37
|
+
fail! failure_message
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def packages_and_versions(output)
|
42
|
+
pkgs_versions = {}
|
43
|
+
pkg_details = output.split("\n\n")[1].split
|
44
|
+
@packages.each do |pkg|
|
45
|
+
pkg_details.each_with_index do |ele, index|
|
46
|
+
next unless ele.start_with?(pkg)
|
47
|
+
pkgs_versions[pkg] = version(pkg_details[index + 1].split('-').first)
|
48
|
+
break
|
49
|
+
end
|
50
|
+
end
|
51
|
+
pkgs_versions
|
52
|
+
end
|
53
|
+
|
54
|
+
def compare_pkg_versions(output)
|
55
|
+
compare_pkg_versions = {}
|
56
|
+
packages_and_versions = packages_and_versions(output)
|
57
|
+
pkg_versions610 = { 'python3-pulp-2to3-migration' => version('0.12'),
|
58
|
+
'tfm-rubygem-katello' => version('4.1') }
|
59
|
+
packages_and_versions.each do |name, version|
|
60
|
+
compare_pkg_versions[name] = version.<=>(pkg_versions610[name])
|
61
|
+
end
|
62
|
+
compare_pkg_versions
|
63
|
+
end
|
26
64
|
end
|
@@ -147,7 +147,7 @@ module ForemanMaintain
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def format_shell_args(options = {})
|
150
|
-
options.map { |shell_optn, val| " #{shell_optn}
|
150
|
+
options.map { |shell_optn, val| " #{shell_optn} #{shellescape(val)}" }.join
|
151
151
|
end
|
152
152
|
|
153
153
|
def find_symlinks(dir_path)
|
@@ -77,11 +77,15 @@ module ForemanMaintain
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def valid_fpc_backup?
|
80
|
-
fpc_online_backup? || fpc_standard_backup? || fpc_logical_backup?
|
80
|
+
fpc_online_backup? || fpc_standard_backup? || fpc_logical_backup? || \
|
81
|
+
# fpc can have setup where mongo or pulpcore db is external but not both
|
82
|
+
fpc_hybrid_db_backup?
|
81
83
|
end
|
82
84
|
|
83
85
|
def valid_katello_backup?
|
84
|
-
katello_online_backup? || katello_standard_backup? || katello_logical_backup?
|
86
|
+
katello_online_backup? || katello_standard_backup? || katello_logical_backup? || \
|
87
|
+
# Katello can have setup where some of dbs are external but not all
|
88
|
+
katello_hybrid_db_backup?
|
85
89
|
end
|
86
90
|
|
87
91
|
def valid_foreman_backup?
|
@@ -104,7 +108,6 @@ module ForemanMaintain
|
|
104
108
|
true
|
105
109
|
end
|
106
110
|
|
107
|
-
# TODO: Need to check for pulpcore feature?
|
108
111
|
def katello_standard_backup?
|
109
112
|
present = [:pgsql_data]
|
110
113
|
absent = [:candlepin_dump, :foreman_dump, :pulpcore_dump, :mongo_dump]
|
@@ -155,6 +158,14 @@ module ForemanMaintain
|
|
155
158
|
:absent => absent)
|
156
159
|
end
|
157
160
|
|
161
|
+
def katello_hybrid_db_backup?
|
162
|
+
all_dbs = { :pgsql_data => %w[candlepin foreman], :mongo_data => [] }
|
163
|
+
all_dbs[:pgsql_data] << 'pulpcore' if feature(:pulpcore_database)
|
164
|
+
all_dbs[:mongo_data] << 'mongo' if feature(:mongo)
|
165
|
+
present, absent = dumps_for_hybrid_db_setup(all_dbs)
|
166
|
+
check_file_existence(:present => present, :absent => absent)
|
167
|
+
end
|
168
|
+
|
158
169
|
def fpc_standard_backup?
|
159
170
|
present = []
|
160
171
|
absent = [:candlepin_dump, :foreman_dump, :pulpcore_dump, :mongo_dump]
|
@@ -207,6 +218,15 @@ module ForemanMaintain
|
|
207
218
|
check_file_existence(:present => present, :absent => absent)
|
208
219
|
end
|
209
220
|
|
221
|
+
def fpc_hybrid_db_backup?
|
222
|
+
all_dbs = { :pgsql_data => [], :mongo_data => [] }
|
223
|
+
all_dbs[:pgsql_data] << 'pulpcore' if feature(:pulpcore_database)
|
224
|
+
all_dbs[:mongo_data] << 'mongo' if feature(:mongo)
|
225
|
+
present, absent = dumps_for_hybrid_db_setup(all_dbs)
|
226
|
+
absent.concat [:candlepin_dump, :foreman_dump]
|
227
|
+
check_file_existence(:present => present, :absent => absent)
|
228
|
+
end
|
229
|
+
|
210
230
|
def foreman_standard_backup?
|
211
231
|
check_file_existence(:present => [:pgsql_data],
|
212
232
|
:absent => [:candlepin_dump, :foreman_dump, :pulpcore_dump,
|
@@ -224,6 +244,27 @@ module ForemanMaintain
|
|
224
244
|
:absent => [:candlepin_dump, :mongo_data, :mongo_dump, :pulpcore_dump])
|
225
245
|
end
|
226
246
|
|
247
|
+
# rubocop:disable Metrics/MethodLength
|
248
|
+
def dumps_for_hybrid_db_setup(dbs_hash)
|
249
|
+
present = []
|
250
|
+
absent = []
|
251
|
+
dbs_hash.each do |data_file, dbs|
|
252
|
+
dbs.each do |db|
|
253
|
+
feature_label = db == 'mongo' ? db : "#{db}_database"
|
254
|
+
dump_file = "#{db}_dump"
|
255
|
+
if feature(feature_label.to_sym).local?
|
256
|
+
present |= [data_file]
|
257
|
+
absent << dump_file.to_sym
|
258
|
+
else
|
259
|
+
present << dump_file.to_sym
|
260
|
+
end
|
261
|
+
end
|
262
|
+
absent |= [data_file] unless present.include?(data_file)
|
263
|
+
end
|
264
|
+
[present, absent]
|
265
|
+
end
|
266
|
+
# rubocop:enable Metrics/MethodLength
|
267
|
+
|
227
268
|
def validate_hostname?
|
228
269
|
# make sure that the system hostname is the same as the backup
|
229
270
|
config_tarball = file_map[:config_files][:path]
|
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.8.
|
4
|
+
version: 0.8.18
|
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-09-
|
11
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|