foreman_maintain 0.8.16 → 0.8.17
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_for_newer_packages.rb +26 -0
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +17 -8
- data/definitions/procedures/backup/snapshot/mount_pulp.rb +2 -2
- data/definitions/procedures/content/prepare.rb +3 -1
- data/definitions/scenarios/content.rb +10 -4
- data/definitions/scenarios/upgrade_to_satellite_6_10.rb +4 -0
- data/lib/foreman_maintain/cli/content_command.rb +2 -1
- data/lib/foreman_maintain/package_manager/yum.rb +3 -2
- data/lib/foreman_maintain/utils/command_runner.rb +5 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f613ab2a7afc435fa01364dac9c15825723b336336676056d7f796b57a21e841
|
4
|
+
data.tar.gz: fd709a9384cb55f2ccf9a9a7e3be34bf239b24748f8fff49fd2921c08df4c228
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55958174a3e670b8ccfefeb09695a8fc84a323901c490f2dc0df88669c2f4d7e870f48a3d5c45f42f668f26fec8fe74d6478b29fcdb2a31f4bbd6b85137f8a41
|
7
|
+
data.tar.gz: 167635eec986782698efdaff762167d18e5a5f63d5f371ebe9600457ced03a6db849465d36c1c9e4fea377dcb47adfec1989e2ed67aaf71dba01d4dcce3a72b3
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Checks::CheckForNewerPackages < ForemanMaintain::Check
|
2
|
+
metadata do
|
3
|
+
label :check_for_newer_packages
|
4
|
+
description 'Check for newer packages and optionally ask for confirmation if not found.'
|
5
|
+
|
6
|
+
param :packages,
|
7
|
+
'package names to validate',
|
8
|
+
:required => true
|
9
|
+
param :manual_confirmation_version,
|
10
|
+
'Version of satellite (6.9) to ask the user if they are on the latest minor release of.',
|
11
|
+
:required => false
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
exit_status, = ForemanMaintain.package_manager.check_update(packages: @packages,
|
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.")
|
19
|
+
if @manual_confirmation_version
|
20
|
+
question = 'Confirm that you are running the latest minor release of Satellite '\
|
21
|
+
"#{@manual_confirmation_version}"
|
22
|
+
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
|
23
|
+
abort! if answer != :yes
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -10,22 +10,31 @@ module Procedures::Backup
|
|
10
10
|
|
11
11
|
def run
|
12
12
|
backup_lv = get_lv_info(@backup_dir)
|
13
|
-
|
14
|
-
dbs = {}
|
15
|
-
dbs[:pulp2] = 'Pulp' if feature(:pulp2) && !@skip_pulp
|
16
|
-
dbs[:mongo] = 'Mongo' if db_local?(:mongo)
|
17
|
-
dbs[:candlepin_database] = 'Candlepin' if db_local?(:candlepin_database)
|
18
|
-
dbs[:foreman_database] = 'Foreman' if db_local?(:foreman_database)
|
19
|
-
dbs[:pulpcore_database] = 'Pulpcore' if db_local?(:pulpcore_database)
|
20
|
-
|
21
13
|
shared_lv = dbs.inject([]) do |list, (db_label, db_name)|
|
22
14
|
db_lv = get_lv_info(feature(db_label).data_dir)
|
23
15
|
list << db_name if db_lv == backup_lv
|
24
16
|
list
|
25
17
|
end
|
18
|
+
|
19
|
+
pulp_data_lv = get_lv_info(current_pulp_feature.pulp_data_dir)
|
20
|
+
shared_lv << 'Pulp' if pulp_data_lv == backup_lv && !@skip_pulp
|
21
|
+
|
26
22
|
confirm(shared_lv) if shared_lv.any?
|
27
23
|
end
|
28
24
|
|
25
|
+
def current_pulp_feature
|
26
|
+
feature(:pulp2) || feature(:pulpcore_database)
|
27
|
+
end
|
28
|
+
|
29
|
+
def dbs
|
30
|
+
dbs = {}
|
31
|
+
dbs[:mongo] = 'Mongo' if db_local?(:mongo)
|
32
|
+
dbs[:candlepin_database] = 'Candlepin' if db_local?(:candlepin_database)
|
33
|
+
dbs[:foreman_database] = 'Foreman' if db_local?(:foreman_database)
|
34
|
+
dbs[:pulpcore_database] = 'Pulpcore' if db_local?(:pulpcore_database)
|
35
|
+
dbs
|
36
|
+
end
|
37
|
+
|
29
38
|
private
|
30
39
|
|
31
40
|
def db_local?(db)
|
@@ -15,8 +15,8 @@ module Procedures::Backup
|
|
15
15
|
def run
|
16
16
|
skip if @skip
|
17
17
|
with_spinner('Creating snapshot of Pulp') do |spinner|
|
18
|
-
current_pulp_feature.with_marked_directory(current_pulp_feature.
|
19
|
-
lv_info = get_lv_info(current_pulp_feature.
|
18
|
+
current_pulp_feature.with_marked_directory(current_pulp_feature.pulp_data_dir) do
|
19
|
+
lv_info = get_lv_info(current_pulp_feature.pulp_data_dir)
|
20
20
|
create_lv_snapshot('pulp-snap', @block_size, lv_info[0])
|
21
21
|
spinner.update("Mounting snapshot of Pulp on #{mount_location('pulp')}")
|
22
22
|
mount_snapshot('pulp', lv_info[1])
|
@@ -3,12 +3,14 @@ module Procedures::Content
|
|
3
3
|
metadata do
|
4
4
|
description 'Prepare content for Pulp 3'
|
5
5
|
for_feature :pulpcore
|
6
|
+
param :quiet, 'Keep the output on a single line', :flag => true, :default => false
|
6
7
|
end
|
7
8
|
|
8
9
|
def run
|
9
10
|
sleep(20) # in satellite 6.9 the services are still coming up
|
10
11
|
# use interactive to get realtime output
|
11
|
-
|
12
|
+
env_vars = @quiet ? '' : 'preserve_output=true '
|
13
|
+
puts execute!("#{env_vars}foreman-rake katello:pulp3_migration", :interactive => true)
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -2,11 +2,10 @@ module ForemanMaintain::Scenarios
|
|
2
2
|
module Content
|
3
3
|
class ContentBase < ForemanMaintain::Scenario
|
4
4
|
def enable_and_start_services
|
5
|
-
add_step(Procedures::Service::Start)
|
6
5
|
add_step(Procedures::Service::Enable.
|
7
6
|
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
8
7
|
add_step(Procedures::Service::Start.
|
9
|
-
new(:
|
8
|
+
new(:include => Features::Pulpcore.pulpcore_migration_services))
|
10
9
|
end
|
11
10
|
|
12
11
|
def disable_and_stop_services
|
@@ -27,12 +26,18 @@ module ForemanMaintain::Scenarios
|
|
27
26
|
def compose
|
28
27
|
if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
|
29
28
|
enable_and_start_services
|
30
|
-
add_step(Procedures::Content::Prepare)
|
29
|
+
add_step(Procedures::Content::Prepare.new(quiet: quiet?))
|
31
30
|
disable_and_stop_services
|
32
31
|
elsif !feature(:satellite)
|
33
|
-
add_step(Procedures::Content::Prepare)
|
32
|
+
add_step(Procedures::Content::Prepare.new(quiet: quiet?))
|
34
33
|
end
|
35
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def quiet?
|
39
|
+
!!context.get(:quiet)
|
40
|
+
end
|
36
41
|
end
|
37
42
|
|
38
43
|
class Switchover < ContentBase
|
@@ -57,6 +62,7 @@ module ForemanMaintain::Scenarios
|
|
57
62
|
|
58
63
|
def compose
|
59
64
|
if !feature(:satellite) || feature(:satellite).at_least_version?('6.9')
|
65
|
+
enable_and_start_services if feature(:satellite)
|
60
66
|
add_step(Procedures::Content::PrepareAbort)
|
61
67
|
disable_and_stop_services if feature(:satellite)
|
62
68
|
end
|
@@ -26,8 +26,12 @@ module Scenarios::Satellite_6_10
|
|
26
26
|
|
27
27
|
def compose
|
28
28
|
add_step(Checks::Puppet::WarnAboutPuppetRemoval)
|
29
|
+
add_step(Checks::CheckForNewerPackages.new(:packages => [foreman_plugin_name('katello'),
|
30
|
+
'python3-pulp-2to3-migration'],
|
31
|
+
:manual_confirmation_version => '6.9'))
|
29
32
|
add_steps(find_checks(:default))
|
30
33
|
add_steps(find_checks(:pre_upgrade))
|
34
|
+
|
31
35
|
add_step(Checks::Foreman::CheckpointSegments)
|
32
36
|
add_step(Checks::Repositories::Validate.new(:version => '6.10'))
|
33
37
|
end
|
@@ -2,8 +2,9 @@ module ForemanMaintain
|
|
2
2
|
module Cli
|
3
3
|
class ContentCommand < Base
|
4
4
|
subcommand 'prepare', 'Prepare content for Pulp 3' do
|
5
|
+
option ['-q', '--quiet'], :flag, 'Keep the output on a single line'
|
5
6
|
def execute
|
6
|
-
run_scenarios_and_exit(Scenarios::Content::Prepare.new)
|
7
|
+
run_scenarios_and_exit(Scenarios::Content::Prepare.new(:quiet => quiet?))
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
@@ -61,8 +61,9 @@ module ForemanMaintain::PackageManager
|
|
61
61
|
yum_action('clean', 'all', :assumeyes => assumeyes)
|
62
62
|
end
|
63
63
|
|
64
|
-
def check_update
|
65
|
-
yum_action('check-update',
|
64
|
+
def check_update(packages: nil, with_status: false)
|
65
|
+
yum_action('check-update', packages, :assumeyes => true, :valid_exit_statuses => [100],
|
66
|
+
:with_status => with_status)
|
66
67
|
end
|
67
68
|
|
68
69
|
def update_available?(package)
|
@@ -59,12 +59,15 @@ module ForemanMaintain
|
|
59
59
|
|
60
60
|
private
|
61
61
|
|
62
|
+
# rubocop:disable Metrics/MethodLength
|
62
63
|
def run_interactively
|
63
64
|
# use tmp files to capture output and exit status of the command when
|
64
65
|
# running interactively
|
65
66
|
log_file = Tempfile.open('captured-output')
|
66
67
|
exit_file = Tempfile.open('captured-exit-code')
|
67
|
-
Kernel.system(
|
68
|
+
Kernel.system(
|
69
|
+
"bash -c '#{full_command}; echo $? > #{exit_file.path}' | tee -i #{log_file.path}"
|
70
|
+
)
|
68
71
|
File.open(log_file.path) { |f| @output = f.read }
|
69
72
|
File.open(exit_file.path) do |f|
|
70
73
|
exit_status = f.read.strip
|
@@ -78,6 +81,7 @@ module ForemanMaintain
|
|
78
81
|
log_file.close
|
79
82
|
exit_file.close
|
80
83
|
end
|
84
|
+
# rubocop:enable Metrics/MethodLength
|
81
85
|
|
82
86
|
def run_non_interactively
|
83
87
|
IO.popen(full_command, 'r+') do |f|
|
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.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- definitions/checks/backup/directory_ready.rb
|
123
123
|
- definitions/checks/candlepin/db_up.rb
|
124
124
|
- definitions/checks/candlepin/validate_db.rb
|
125
|
+
- definitions/checks/check_for_newer_packages.rb
|
125
126
|
- definitions/checks/check_hotfix_installed.rb
|
126
127
|
- definitions/checks/check_tmout.rb
|
127
128
|
- definitions/checks/disk/available_space.rb
|
@@ -415,7 +416,7 @@ homepage: https://github.com/theforeman/foreman_maintain
|
|
415
416
|
licenses:
|
416
417
|
- GPL-3.0
|
417
418
|
metadata: {}
|
418
|
-
post_install_message:
|
419
|
+
post_install_message:
|
419
420
|
rdoc_options: []
|
420
421
|
require_paths:
|
421
422
|
- lib
|
@@ -430,8 +431,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
430
431
|
- !ruby/object:Gem::Version
|
431
432
|
version: '0'
|
432
433
|
requirements: []
|
433
|
-
rubygems_version: 3.
|
434
|
-
signing_key:
|
434
|
+
rubygems_version: 3.0.9
|
435
|
+
signing_key:
|
435
436
|
specification_version: 4
|
436
437
|
summary: Foreman maintenance tool belt
|
437
438
|
test_files: []
|