foreman_maintain 1.6.8 → 1.6.9
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/features/foreman_install.rb +12 -0
- data/definitions/features/instance.rb +18 -0
- data/definitions/features/satellite.rb +4 -0
- data/definitions/procedures/installer/upgrade_rake_task.rb +4 -3
- data/definitions/scenarios/restore.rb +1 -1
- data/definitions/scenarios/{upgrade_to_satellite_6_16.rb → satellite_upgrade.rb} +9 -10
- data/definitions/scenarios/self_upgrade.rb +18 -9
- data/lib/foreman_maintain/cli/upgrade_command.rb +1 -12
- data/lib/foreman_maintain/utils/backup.rb +8 -0
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +3 -4
- data/definitions/scenarios/upgrade_to_capsule_6_16.rb +0 -102
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdd4ef357f342501b15fbaf461be19952c2d09fde6fb7c1f3523711201ef3faa
|
4
|
+
data.tar.gz: cc9b2d323a171c5676276767f11c4a83adc5123fab01f58114d88a80a3ddba13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fffefa90d5f28514280c732cb232003acb543420a9ca9fd5a9cf77749beecb1533a05d71bb6b7c5db1e3e06dcb5909a5fa3e8f85ef3a98ae369f090cef84c052
|
7
|
+
data.tar.gz: cb4997dcbb7eba53f9e4d82445ad327316e3a1ace686e62ffd0b3f4a63ecd418542d73c42d7fe10692fb48054dc902b42faaff2772c744e91c421160210fec13
|
@@ -9,4 +9,16 @@ class Features::ForemanInstall < ForemanMaintain::Feature
|
|
9
9
|
!feature(:instance).downstream && feature(:foreman_server)
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
def target_version
|
14
|
+
'3.11'
|
15
|
+
end
|
16
|
+
|
17
|
+
def current_version
|
18
|
+
@current_version ||= package_version(package_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def package_name
|
22
|
+
'foreman'
|
23
|
+
end
|
12
24
|
end
|
@@ -91,6 +91,24 @@ class Features::Instance < ForemanMaintain::Feature
|
|
91
91
|
feature(:foreman_install) || feature(:katello_install)
|
92
92
|
end
|
93
93
|
|
94
|
+
def current_version
|
95
|
+
version = if feature(:instance).downstream
|
96
|
+
feature(:instance).downstream.current_version
|
97
|
+
else
|
98
|
+
feature(:foreman_install).current_version
|
99
|
+
end
|
100
|
+
|
101
|
+
version.to_s[/^\d+\.\d+\.\d+/]
|
102
|
+
end
|
103
|
+
|
104
|
+
def target_version
|
105
|
+
if feature(:instance).downstream
|
106
|
+
Features::Satellite.new.target_version
|
107
|
+
else
|
108
|
+
Features::ForemanInstall.new.target_version
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
94
112
|
private
|
95
113
|
|
96
114
|
# rubocop:disable Metrics/AbcSize
|
@@ -2,12 +2,13 @@ module Procedures::Installer
|
|
2
2
|
class UpgradeRakeTask < ForemanMaintain::Procedure
|
3
3
|
metadata do
|
4
4
|
description 'Execute upgrade:run rake task'
|
5
|
+
confine do
|
6
|
+
feature(:satellite)
|
7
|
+
end
|
5
8
|
end
|
6
9
|
|
7
10
|
def run
|
8
|
-
|
9
|
-
# the installer runs this rake task for us already
|
10
|
-
execute!('foreman-rake upgrade:run') if feature(:satellite)
|
11
|
+
execute!('foreman-rake upgrade:run')
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
@@ -35,7 +35,7 @@ module ForemanMaintain::Scenarios
|
|
35
35
|
add_step_with_context(Procedures::Service::Stop)
|
36
36
|
add_steps_with_context(Procedures::Restore::ExtractFiles) if backup.tar_backups_exist?
|
37
37
|
|
38
|
-
if backup.
|
38
|
+
if backup.sql_needs_dump_restore?
|
39
39
|
add_steps_with_context(Procedures::Restore::DropDatabases)
|
40
40
|
restore_sql_dumps(backup)
|
41
41
|
end
|
@@ -1,11 +1,10 @@
|
|
1
|
-
module Scenarios::
|
1
|
+
module Scenarios::Satellite
|
2
2
|
class Abstract < ForemanMaintain::Scenario
|
3
3
|
def self.upgrade_metadata(&block)
|
4
4
|
metadata do
|
5
5
|
tags :upgrade_scenario
|
6
6
|
confine do
|
7
|
-
feature(:
|
8
|
-
(feature(:satellite).current_minor_version == '6.15' || \
|
7
|
+
(feature(:downstream).current_minor_version == '6.15' || \
|
9
8
|
ForemanMaintain.upgrade_in_progress == '6.16')
|
10
9
|
end
|
11
10
|
instance_eval(&block)
|
@@ -19,7 +18,7 @@ module Scenarios::Satellite_6_16
|
|
19
18
|
|
20
19
|
class PreUpgradeCheck < Abstract
|
21
20
|
upgrade_metadata do
|
22
|
-
description 'Checks before upgrading
|
21
|
+
description 'Checks before upgrading'
|
23
22
|
tags :pre_upgrade_checks
|
24
23
|
run_strategy :fail_slow
|
25
24
|
end
|
@@ -29,14 +28,14 @@ module Scenarios::Satellite_6_16
|
|
29
28
|
add_steps(find_checks(:pre_upgrade))
|
30
29
|
add_step(Checks::CheckIpv6Disable)
|
31
30
|
add_step(Checks::Disk::AvailableSpacePostgresql13)
|
32
|
-
add_step(Checks::Repositories::Validate.new(:version =>
|
31
|
+
add_step(Checks::Repositories::Validate.new(:version => target_version))
|
33
32
|
add_step(Checks::CheckOrganizationContentAccessMode)
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
36
|
class PreMigrations < Abstract
|
38
37
|
upgrade_metadata do
|
39
|
-
description 'Procedures before migrating
|
38
|
+
description 'Procedures before migrating'
|
40
39
|
tags :pre_migrations
|
41
40
|
end
|
42
41
|
|
@@ -47,7 +46,7 @@ module Scenarios::Satellite_6_16
|
|
47
46
|
|
48
47
|
class Migrations < Abstract
|
49
48
|
upgrade_metadata do
|
50
|
-
description 'Migration scripts
|
49
|
+
description 'Migration scripts'
|
51
50
|
tags :migrations
|
52
51
|
run_strategy :fail_fast
|
53
52
|
end
|
@@ -57,7 +56,7 @@ module Scenarios::Satellite_6_16
|
|
57
56
|
end
|
58
57
|
|
59
58
|
def compose
|
60
|
-
add_step(Procedures::Repositories::Setup.new(:version =>
|
59
|
+
add_step(Procedures::Repositories::Setup.new(:version => target_version))
|
61
60
|
if el8?
|
62
61
|
modules_to_switch = ['postgresql:13']
|
63
62
|
add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
|
@@ -77,7 +76,7 @@ module Scenarios::Satellite_6_16
|
|
77
76
|
|
78
77
|
class PostMigrations < Abstract
|
79
78
|
upgrade_metadata do
|
80
|
-
description 'Procedures after migrating
|
79
|
+
description 'Procedures after migrating'
|
81
80
|
tags :post_migrations
|
82
81
|
end
|
83
82
|
|
@@ -90,7 +89,7 @@ module Scenarios::Satellite_6_16
|
|
90
89
|
|
91
90
|
class PostUpgradeChecks < Abstract
|
92
91
|
upgrade_metadata do
|
93
|
-
description 'Checks after upgrading
|
92
|
+
description 'Checks after upgrading'
|
94
93
|
tags :post_upgrade_checks
|
95
94
|
run_strategy :fail_slow
|
96
95
|
end
|
@@ -4,11 +4,11 @@ module ForemanMaintain::Scenarios
|
|
4
4
|
include ForemanMaintain::Concerns::Versions
|
5
5
|
|
6
6
|
def target_version
|
7
|
-
|
7
|
+
feature(:instance).target_version
|
8
8
|
end
|
9
9
|
|
10
10
|
def current_version
|
11
|
-
feature(:instance).
|
11
|
+
feature(:instance).current_version
|
12
12
|
end
|
13
13
|
|
14
14
|
def maintenance_repo_label
|
@@ -47,12 +47,11 @@ module ForemanMaintain::Scenarios
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
50
|
+
def self_upgrade_allowed?
|
51
|
+
target = Gem::Version.new(target_version).version
|
52
|
+
|
53
|
+
Gem::Version.new(current_version).segments[0..1].join('.') == target ||
|
54
|
+
Gem::Version.new(current_version).bump.segments[0..1].join('.') == target
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
@@ -65,6 +64,16 @@ module ForemanMaintain::Scenarios
|
|
65
64
|
end
|
66
65
|
|
67
66
|
def downstream_self_upgrade(pkgs_to_update)
|
67
|
+
unless self_upgrade_allowed?
|
68
|
+
raise(
|
69
|
+
ForemanMaintain::Error::Warn,
|
70
|
+
"foreman-maintain is too many versions ahead. The target " \
|
71
|
+
"version is #{target_version} while the currently installed " \
|
72
|
+
"version is #{current_version}. Please rollback " \
|
73
|
+
"foreman-maintain to the proper version."
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
68
77
|
ForemanMaintain.enable_maintenance_module
|
69
78
|
|
70
79
|
add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true,
|
@@ -77,7 +86,7 @@ module ForemanMaintain::Scenarios
|
|
77
86
|
# 2. Update the foreman-maintain packages from next major version repository
|
78
87
|
# 3. Rollback the repository to current major version
|
79
88
|
|
80
|
-
add_step(Procedures::Repositories::Setup.new(:version =>
|
89
|
+
add_step(Procedures::Repositories::Setup.new(:version => target_version))
|
81
90
|
add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true))
|
82
91
|
ensure
|
83
92
|
rollback_repositories
|
@@ -74,21 +74,10 @@ module ForemanMaintain
|
|
74
74
|
interactive_option
|
75
75
|
disable_self_upgrade_option
|
76
76
|
|
77
|
-
option '--phase', 'phase', 'run only a specific phase', :required => false do |phase|
|
78
|
-
unless UpgradeRunner::PHASES.include?(phase.to_sym)
|
79
|
-
raise Error::UsageError, "Unknown phase #{phase}"
|
80
|
-
end
|
81
|
-
phase
|
82
|
-
end
|
83
|
-
|
84
77
|
def execute
|
85
78
|
ForemanMaintain.validate_downstream_packages
|
86
79
|
ForemanMaintain.perform_self_upgrade if allow_self_upgrade?
|
87
|
-
|
88
|
-
upgrade_runner.run_phase(phase.to_sym)
|
89
|
-
else
|
90
|
-
upgrade_runner.run
|
91
|
-
end
|
80
|
+
upgrade_runner.run
|
92
81
|
upgrade_runner.save
|
93
82
|
exit upgrade_runner.exit_code
|
94
83
|
end
|
@@ -223,12 +223,20 @@ module ForemanMaintain
|
|
223
223
|
file_map[:pgsql_data][:present]
|
224
224
|
end
|
225
225
|
|
226
|
+
def sql_tar_files_exist?
|
227
|
+
file_map[:pgsql_data][:present]
|
228
|
+
end
|
229
|
+
|
226
230
|
def sql_dump_files_exist?
|
227
231
|
file_map[:foreman_dump][:present] ||
|
228
232
|
file_map[:candlepin_dump][:present] ||
|
229
233
|
file_map[:pulpcore_dump][:present]
|
230
234
|
end
|
231
235
|
|
236
|
+
def sql_needs_dump_restore?
|
237
|
+
!sql_tar_files_exist? && sql_dump_files_exist?
|
238
|
+
end
|
239
|
+
|
232
240
|
def incremental?
|
233
241
|
!!metadata.fetch('incremental', false)
|
234
242
|
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.6.
|
4
|
+
version: 1.6.9
|
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: 2024-06-
|
11
|
+
date: 2024-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -313,11 +313,10 @@ files:
|
|
313
313
|
- definitions/scenarios/packages.rb
|
314
314
|
- definitions/scenarios/puppet.rb
|
315
315
|
- definitions/scenarios/restore.rb
|
316
|
+
- definitions/scenarios/satellite_upgrade.rb
|
316
317
|
- definitions/scenarios/self_upgrade.rb
|
317
318
|
- definitions/scenarios/services.rb
|
318
319
|
- definitions/scenarios/update.rb
|
319
|
-
- definitions/scenarios/upgrade_to_capsule_6_16.rb
|
320
|
-
- definitions/scenarios/upgrade_to_satellite_6_16.rb
|
321
320
|
- extras/foreman-maintain.sh
|
322
321
|
- extras/foreman_protector/dnf/foreman-protector.py
|
323
322
|
- extras/foreman_protector/foreman-protector.conf
|
@@ -1,102 +0,0 @@
|
|
1
|
-
module Scenarios::Capsule_6_16
|
2
|
-
class Abstract < ForemanMaintain::Scenario
|
3
|
-
def self.upgrade_metadata(&block)
|
4
|
-
metadata do
|
5
|
-
tags :upgrade_scenario
|
6
|
-
confine do
|
7
|
-
feature(:capsule) &&
|
8
|
-
(feature(:capsule).current_minor_version == '6.15' || \
|
9
|
-
ForemanMaintain.upgrade_in_progress == '6.16')
|
10
|
-
end
|
11
|
-
instance_eval(&block)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def target_version
|
16
|
-
'6.16'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class PreUpgradeCheck < Abstract
|
21
|
-
upgrade_metadata do
|
22
|
-
description 'Checks before upgrading to Capsule 6.16'
|
23
|
-
tags :pre_upgrade_checks
|
24
|
-
run_strategy :fail_slow
|
25
|
-
end
|
26
|
-
|
27
|
-
def compose
|
28
|
-
add_steps(find_checks(:default))
|
29
|
-
add_steps(find_checks(:pre_upgrade))
|
30
|
-
add_step(Checks::CheckIpv6Disable)
|
31
|
-
add_step(Checks::Disk::AvailableSpacePostgresql13)
|
32
|
-
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class PreMigrations < Abstract
|
37
|
-
upgrade_metadata do
|
38
|
-
description 'Procedures before migrating to Capsule 6.16'
|
39
|
-
tags :pre_migrations
|
40
|
-
end
|
41
|
-
|
42
|
-
def compose
|
43
|
-
add_steps(find_procedures(:pre_migrations))
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class Migrations < Abstract
|
48
|
-
upgrade_metadata do
|
49
|
-
description 'Migration scripts to Capsule 6.16'
|
50
|
-
tags :migrations
|
51
|
-
end
|
52
|
-
|
53
|
-
def set_context_mapping
|
54
|
-
context.map(:assumeyes, Procedures::Installer::Run => :assumeyes)
|
55
|
-
end
|
56
|
-
|
57
|
-
def compose
|
58
|
-
add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
|
59
|
-
if el8?
|
60
|
-
modules_to_switch = ['postgresql:13']
|
61
|
-
add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
|
62
|
-
modules_to_enable = ["satellite-capsule:#{el_short_name}"]
|
63
|
-
add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
|
64
|
-
end
|
65
|
-
add_step(Procedures::Packages::Update.new(
|
66
|
-
:assumeyes => true,
|
67
|
-
:download_only => true
|
68
|
-
))
|
69
|
-
add_step(Procedures::Service::Stop.new)
|
70
|
-
add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
|
71
|
-
add_step_with_context(Procedures::Installer::Run)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
class PostMigrations < Abstract
|
76
|
-
upgrade_metadata do
|
77
|
-
description 'Procedures after migrating to Capsule 6.16'
|
78
|
-
tags :post_migrations
|
79
|
-
end
|
80
|
-
|
81
|
-
def compose
|
82
|
-
add_step(Procedures::RefreshFeatures)
|
83
|
-
add_step(Procedures::Service::Start.new)
|
84
|
-
add_steps(find_procedures(:post_migrations))
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
class PostUpgradeChecks < Abstract
|
89
|
-
upgrade_metadata do
|
90
|
-
description 'Checks after upgrading to Capsule 6.16'
|
91
|
-
tags :post_upgrade_checks
|
92
|
-
run_strategy :fail_slow
|
93
|
-
end
|
94
|
-
|
95
|
-
def compose
|
96
|
-
add_steps(find_checks(:default))
|
97
|
-
add_steps(find_checks(:post_upgrade))
|
98
|
-
add_step(Procedures::Packages::CheckForReboot)
|
99
|
-
add_step(Procedures::Pulpcore::ContainerHandleImageMetadata)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|