foreman_maintain 1.6.6 → 1.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/features/foreman_install.rb +1 -1
- data/definitions/procedures/packages/update.rb +0 -2
- data/definitions/procedures/repositories/setup.rb +1 -1
- data/definitions/scenarios/foreman_upgrade.rb +141 -0
- data/definitions/scenarios/update.rb +1 -1
- data/lib/foreman_maintain/cli/update_command.rb +7 -5
- data/lib/foreman_maintain/concerns/system_helpers.rb +0 -1
- data/lib/foreman_maintain/package_manager/apt.rb +1 -3
- data/lib/foreman_maintain/package_manager/dnf.rb +1 -2
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +3 -4
- data/definitions/scenarios/upgrade_to_foreman_nightly.rb +0 -91
- data/definitions/scenarios/upgrade_to_katello_nightly.rb +0 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c513edc079ddea8f18904feeed2d3299c59949183703f7344946c8828abee6b6
|
4
|
+
data.tar.gz: 2fb58c156aaf22a0b1be982768a267926f8f080b063a2169ab6868fa1955b26d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbd8eb809ab9f165b461dd2b29e8af8b5ffdee2d285462d9a9b626e93f922ac20066d166a751524c80edbadb6c465cbb6a5661529591da7188608ff0d48467b3
|
7
|
+
data.tar.gz: 7450630a6ab864eec72be71fd6b948f016d59f8f1e6dcbc11c8110d41bbde62504f16acc40b9bd3ff2e5b902cd316555fb03ebf72c2606b851824fbf8d50fb6f
|
@@ -6,7 +6,6 @@ module Procedures::Packages
|
|
6
6
|
param :force, 'Do not skip if package is installed', :flag => true, :default => false
|
7
7
|
param :warn_on_errors, 'Do not interrupt scenario on failure',
|
8
8
|
:flag => true, :default => false
|
9
|
-
param :dnf_options, 'Extra dnf options if any', :array => true, :default => []
|
10
9
|
param :download_only, 'Download and cache packages only', :flag => true, :default => false
|
11
10
|
param :clean_cache, 'If true will cause a DNF cache clean', :flag => true, :default => true
|
12
11
|
end
|
@@ -16,7 +15,6 @@ module Procedures::Packages
|
|
16
15
|
package_manager.clean_cache(:assumeyes => assumeyes_val) if @clean_cache
|
17
16
|
opts = {
|
18
17
|
:assumeyes => assumeyes_val,
|
19
|
-
:options => @dnf_options,
|
20
18
|
:download_only => @download_only,
|
21
19
|
}
|
22
20
|
packages_action(:update, @packages, opts)
|
@@ -3,7 +3,7 @@ module Procedures::Repositories
|
|
3
3
|
metadata do
|
4
4
|
description 'Setup repositories'
|
5
5
|
confine do
|
6
|
-
feature(:instance).downstream || feature(:
|
6
|
+
feature(:instance).downstream || feature(:instance).upstream_install
|
7
7
|
end
|
8
8
|
param :version,
|
9
9
|
'Version for which repositories needs to be setup',
|
@@ -0,0 +1,141 @@
|
|
1
|
+
module Scenarios::ForemanUpgrade
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_scenario
|
6
|
+
confine do
|
7
|
+
feature(:foreman_install)
|
8
|
+
end
|
9
|
+
instance_eval(&block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def target_version
|
14
|
+
'nightly'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class PreUpgradeCheck < Abstract
|
19
|
+
upgrade_metadata do
|
20
|
+
description 'Checks before upgrading'
|
21
|
+
tags :pre_upgrade_checks
|
22
|
+
run_strategy :fail_slow
|
23
|
+
end
|
24
|
+
|
25
|
+
# rubocop:disable Metrics/MethodLength
|
26
|
+
def compose
|
27
|
+
add_steps(
|
28
|
+
Checks::Foreman::FactsNames, # if Foreman database present
|
29
|
+
Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp
|
30
|
+
Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc
|
31
|
+
Checks::ForemanTasks::NotPaused, # if foreman-tasks present
|
32
|
+
Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver
|
33
|
+
Checks::ServerPing,
|
34
|
+
Checks::ServicesUp,
|
35
|
+
Checks::SystemRegistration,
|
36
|
+
Checks::CheckHotfixInstalled,
|
37
|
+
Checks::CheckTmout,
|
38
|
+
Checks::CheckUpstreamRepository,
|
39
|
+
Checks::Disk::AvailableSpace,
|
40
|
+
Checks::Disk::AvailableSpaceCandlepin, # if candlepin
|
41
|
+
Checks::Foreman::ValidateExternalDbVersion, # if external database
|
42
|
+
Checks::Foreman::CheckCorruptedRoles,
|
43
|
+
Checks::Foreman::CheckDuplicatePermissions,
|
44
|
+
Checks::Foreman::TuningRequirements, # if katello present
|
45
|
+
Checks::ForemanOpenscap::InvalidReportAssociations, # if foreman-openscap
|
46
|
+
Checks::ForemanTasks::Invalid::CheckOld, # if foreman-tasks
|
47
|
+
Checks::ForemanTasks::Invalid::CheckPendingState, # if foreman-tasks
|
48
|
+
Checks::ForemanTasks::Invalid::CheckPlanningState, # if foreman-tasks
|
49
|
+
Checks::ForemanTasks::NotRunning, # if foreman-tasks
|
50
|
+
Checks::NonRhPackages,
|
51
|
+
Checks::PackageManager::Dnf::ValidateDnfConfig,
|
52
|
+
Checks::Repositories::CheckNonRhRepository,
|
53
|
+
Checks::Repositories::Validate
|
54
|
+
)
|
55
|
+
end
|
56
|
+
# rubocop:enable Metrics/MethodLength
|
57
|
+
end
|
58
|
+
|
59
|
+
class PreMigrations < Abstract
|
60
|
+
upgrade_metadata do
|
61
|
+
description 'Procedures before upgrading'
|
62
|
+
tags :pre_migrations
|
63
|
+
end
|
64
|
+
|
65
|
+
def compose
|
66
|
+
add_steps(
|
67
|
+
Procedures::MaintenanceMode::EnableMaintenanceMode,
|
68
|
+
Procedures::Crond::Stop,
|
69
|
+
Procedures::SyncPlans::Disable
|
70
|
+
)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class Migrations < Abstract
|
75
|
+
upgrade_metadata do
|
76
|
+
description 'Upgrade steps'
|
77
|
+
tags :migrations
|
78
|
+
run_strategy :fail_fast
|
79
|
+
end
|
80
|
+
|
81
|
+
def set_context_mapping
|
82
|
+
context.map(:assumeyes, Procedures::Installer::Run => :assumeyes)
|
83
|
+
end
|
84
|
+
|
85
|
+
def compose
|
86
|
+
add_step(Procedures::Repositories::Setup.new(:version => 'nightly'))
|
87
|
+
if el8?
|
88
|
+
modules_to_switch = ['postgresql:13']
|
89
|
+
add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
|
90
|
+
end
|
91
|
+
|
92
|
+
add_step(Procedures::Packages::Update.new(
|
93
|
+
:assumeyes => true,
|
94
|
+
:download_only => true
|
95
|
+
))
|
96
|
+
add_step(Procedures::Service::Stop.new)
|
97
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
|
98
|
+
|
99
|
+
add_step_with_context(Procedures::Installer::Run)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class PostMigrations < Abstract
|
104
|
+
upgrade_metadata do
|
105
|
+
description 'Post upgrade procedures'
|
106
|
+
tags :post_migrations
|
107
|
+
end
|
108
|
+
|
109
|
+
def compose
|
110
|
+
add_steps(
|
111
|
+
Procedures::RefreshFeatures,
|
112
|
+
Procedures::Service::Start,
|
113
|
+
Procedures::Crond::Start,
|
114
|
+
Procedures::SyncPlans::Enable,
|
115
|
+
Procedures::MaintenanceMode::DisableMaintenanceMode
|
116
|
+
)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class PostUpgradeChecks < Abstract
|
121
|
+
upgrade_metadata do
|
122
|
+
description 'Checks after upgrading'
|
123
|
+
tags :post_upgrade_checks
|
124
|
+
run_strategy :fail_slow
|
125
|
+
end
|
126
|
+
|
127
|
+
def compose
|
128
|
+
add_steps(
|
129
|
+
Checks::Foreman::FactsNames, # if Foreman database present
|
130
|
+
Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp
|
131
|
+
Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc
|
132
|
+
Checks::ForemanTasks::NotPaused, # if foreman-tasks present
|
133
|
+
Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver
|
134
|
+
Checks::ServerPing,
|
135
|
+
Checks::ServicesUp,
|
136
|
+
Checks::SystemRegistration,
|
137
|
+
Procedures::Packages::CheckForReboot
|
138
|
+
)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -26,8 +26,9 @@ module ForemanMaintain
|
|
26
26
|
def execute
|
27
27
|
ForemanMaintain.validate_downstream_packages
|
28
28
|
ForemanMaintain.perform_self_upgrade unless disable_self_update?
|
29
|
-
update_runner
|
30
|
-
|
29
|
+
runner = update_runner
|
30
|
+
runner.run_phase(:pre_update_checks)
|
31
|
+
exit runner.exit_code
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -38,9 +39,10 @@ module ForemanMaintain
|
|
38
39
|
def execute
|
39
40
|
ForemanMaintain.validate_downstream_packages
|
40
41
|
ForemanMaintain.perform_self_upgrade unless disable_self_update?
|
41
|
-
update_runner
|
42
|
-
|
43
|
-
|
42
|
+
runner = update_runner
|
43
|
+
runner.run
|
44
|
+
runner.save
|
45
|
+
exit runner.exit_code
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
@@ -19,12 +19,10 @@ module ForemanMaintain::PackageManager
|
|
19
19
|
apt_action('remove', packages, :assumeyes => assumeyes)
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
def update(packages = [], assumeyes: false, options: [], download_only: false)
|
22
|
+
def update(packages = [], assumeyes: false, download_only: false)
|
24
23
|
action = packages.any? ? '--only-upgrade install' : 'upgrade'
|
25
24
|
apt_action(action, packages, :assumeyes => assumeyes, :download_only => download_only)
|
26
25
|
end
|
27
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
28
26
|
|
29
27
|
def clean_cache(assumeyes: false)
|
30
28
|
apt_action('clean', [], :assumeyes => assumeyes)
|
@@ -59,12 +59,11 @@ module ForemanMaintain::PackageManager
|
|
59
59
|
dnf_action('remove', packages, assumeyes: assumeyes)
|
60
60
|
end
|
61
61
|
|
62
|
-
def update(packages = [], assumeyes: false,
|
62
|
+
def update(packages = [], assumeyes: false, download_only: false)
|
63
63
|
dnf_action(
|
64
64
|
'update',
|
65
65
|
packages,
|
66
66
|
assumeyes: assumeyes,
|
67
|
-
dnf_options: options,
|
68
67
|
download_only: download_only
|
69
68
|
)
|
70
69
|
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.7
|
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-05-
|
11
|
+
date: 2024-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -310,6 +310,7 @@ files:
|
|
310
310
|
- definitions/procedures/sync_plans/disable.rb
|
311
311
|
- definitions/procedures/sync_plans/enable.rb
|
312
312
|
- definitions/scenarios/backup.rb
|
313
|
+
- definitions/scenarios/foreman_upgrade.rb
|
313
314
|
- definitions/scenarios/maintenance_mode.rb
|
314
315
|
- definitions/scenarios/packages.rb
|
315
316
|
- definitions/scenarios/puppet.rb
|
@@ -319,8 +320,6 @@ files:
|
|
319
320
|
- definitions/scenarios/update.rb
|
320
321
|
- definitions/scenarios/upgrade_to_capsule_6_16.rb
|
321
322
|
- definitions/scenarios/upgrade_to_capsule_6_16_z.rb
|
322
|
-
- definitions/scenarios/upgrade_to_foreman_nightly.rb
|
323
|
-
- definitions/scenarios/upgrade_to_katello_nightly.rb
|
324
323
|
- definitions/scenarios/upgrade_to_satellite_6_16.rb
|
325
324
|
- definitions/scenarios/upgrade_to_satellite_6_16_z.rb
|
326
325
|
- extras/foreman-maintain.sh
|
@@ -1,91 +0,0 @@
|
|
1
|
-
module Scenarios::Foreman_Nightly
|
2
|
-
class Abstract < ForemanMaintain::Scenario
|
3
|
-
def self.upgrade_metadata(&block)
|
4
|
-
metadata do
|
5
|
-
tags :upgrade_scenario
|
6
|
-
confine do
|
7
|
-
feature(:foreman_install) || ForemanMaintain.upgrade_in_progress == 'nightly'
|
8
|
-
end
|
9
|
-
instance_eval(&block)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def target_version
|
14
|
-
'nightly'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class PreUpgradeCheck < Abstract
|
19
|
-
upgrade_metadata do
|
20
|
-
description 'Checks before upgrading to Foreman nightly'
|
21
|
-
tags :pre_upgrade_checks
|
22
|
-
run_strategy :fail_slow
|
23
|
-
end
|
24
|
-
|
25
|
-
def compose
|
26
|
-
add_steps(find_checks(:default))
|
27
|
-
add_steps(find_checks(:pre_upgrade))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class PreMigrations < Abstract
|
32
|
-
upgrade_metadata do
|
33
|
-
description 'Procedures before upgrading to Foreman nightly'
|
34
|
-
tags :pre_migrations
|
35
|
-
end
|
36
|
-
|
37
|
-
def compose
|
38
|
-
add_steps(find_procedures(:pre_migrations))
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class Migrations < Abstract
|
43
|
-
upgrade_metadata do
|
44
|
-
description 'Upgrade steps for Foreman nightly'
|
45
|
-
tags :migrations
|
46
|
-
run_strategy :fail_fast
|
47
|
-
end
|
48
|
-
|
49
|
-
def set_context_mapping
|
50
|
-
context.map(:assumeyes, Procedures::Installer::Run => :assumeyes)
|
51
|
-
end
|
52
|
-
|
53
|
-
def compose
|
54
|
-
add_step(Procedures::Repositories::Setup.new(:version => 'nightly'))
|
55
|
-
if el8?
|
56
|
-
modules_to_switch = ['postgresql:13']
|
57
|
-
add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
|
58
|
-
modules_to_enable = ["foreman:#{el_short_name}"]
|
59
|
-
add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
|
60
|
-
end
|
61
|
-
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
62
|
-
add_step_with_context(Procedures::Installer::Run)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
class PostMigrations < Abstract
|
67
|
-
upgrade_metadata do
|
68
|
-
description 'Post upgrade procedures for Foreman nightly'
|
69
|
-
tags :post_migrations
|
70
|
-
end
|
71
|
-
|
72
|
-
def compose
|
73
|
-
add_step(Procedures::RefreshFeatures)
|
74
|
-
add_step(Procedures::Service::Start.new)
|
75
|
-
add_steps(find_procedures(:post_migrations))
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
class PostUpgradeChecks < Abstract
|
80
|
-
upgrade_metadata do
|
81
|
-
description 'Checks after upgrading to Foreman nightly'
|
82
|
-
tags :post_upgrade_checks
|
83
|
-
run_strategy :fail_slow
|
84
|
-
end
|
85
|
-
|
86
|
-
def compose
|
87
|
-
add_steps(find_checks(:default))
|
88
|
-
add_steps(find_checks(:post_upgrade))
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
module Scenarios::Katello_Nightly
|
2
|
-
class Abstract < ForemanMaintain::Scenario
|
3
|
-
def self.upgrade_metadata(&block)
|
4
|
-
metadata do
|
5
|
-
tags :upgrade_scenario
|
6
|
-
confine do
|
7
|
-
feature(:katello_install) || ForemanMaintain.upgrade_in_progress == 'nightly'
|
8
|
-
end
|
9
|
-
instance_eval(&block)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def target_version
|
14
|
-
'nightly'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class PreUpgradeCheck < Abstract
|
19
|
-
upgrade_metadata do
|
20
|
-
description 'Checks before upgrading to Katello nightly'
|
21
|
-
tags :pre_upgrade_checks
|
22
|
-
run_strategy :fail_slow
|
23
|
-
end
|
24
|
-
|
25
|
-
def compose
|
26
|
-
add_steps(find_checks(:default))
|
27
|
-
add_steps(find_checks(:pre_upgrade))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class PreMigrations < Abstract
|
32
|
-
upgrade_metadata do
|
33
|
-
description 'Procedures before upgrading to Katello nightly'
|
34
|
-
tags :pre_migrations
|
35
|
-
end
|
36
|
-
|
37
|
-
def compose
|
38
|
-
add_steps(find_procedures(:pre_migrations))
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class Migrations < Abstract
|
43
|
-
upgrade_metadata do
|
44
|
-
description 'Upgrade steps for Katello nightly'
|
45
|
-
tags :migrations
|
46
|
-
run_strategy :fail_fast
|
47
|
-
end
|
48
|
-
|
49
|
-
def set_context_mapping
|
50
|
-
context.map(:assumeyes, Procedures::Installer::Run => :assumeyes)
|
51
|
-
end
|
52
|
-
|
53
|
-
def compose
|
54
|
-
add_step(Procedures::Repositories::Setup.new(:version => 'nightly'))
|
55
|
-
if el8?
|
56
|
-
modules_to_switch = ['postgresql:13']
|
57
|
-
add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
|
58
|
-
modules_to_enable = ["katello:#{el_short_name}", "pulpcore:#{el_short_name}"]
|
59
|
-
add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
|
60
|
-
end
|
61
|
-
add_step(Procedures::Packages::Update.new(
|
62
|
-
:assumeyes => true,
|
63
|
-
:download_only => true
|
64
|
-
))
|
65
|
-
add_step(Procedures::Service::Stop.new)
|
66
|
-
add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
|
67
|
-
add_step_with_context(Procedures::Installer::Run)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
class PostMigrations < Abstract
|
72
|
-
upgrade_metadata do
|
73
|
-
description 'Post upgrade procedures for Katello nightly'
|
74
|
-
tags :post_migrations
|
75
|
-
end
|
76
|
-
|
77
|
-
def compose
|
78
|
-
add_step(Procedures::RefreshFeatures)
|
79
|
-
add_step(Procedures::Service::Start.new)
|
80
|
-
add_steps(find_procedures(:post_migrations))
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
class PostUpgradeChecks < Abstract
|
85
|
-
upgrade_metadata do
|
86
|
-
description 'Checks after upgrading to Katello nightly'
|
87
|
-
tags :post_upgrade_checks
|
88
|
-
run_strategy :fail_slow
|
89
|
-
end
|
90
|
-
|
91
|
-
def compose
|
92
|
-
add_steps(find_checks(:default))
|
93
|
-
add_steps(find_checks(:post_upgrade))
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|