foreman_maintain 0.6.5 → 0.6.10
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/README.md +55 -10
- data/bin/foreman-maintain-complete +3 -2
- data/definitions/checks/env_proxy.rb +13 -0
- data/definitions/checks/foreman/check_checkpoint_segments.rb +51 -0
- data/definitions/checks/foreman/check_duplicate_permission.rb +33 -0
- data/definitions/checks/foreman_proxy/check_tftp_storage.rb +51 -0
- data/definitions/checks/foreman_proxy/verify_dhcp_config_syntax.rb +7 -9
- data/definitions/checks/repositories/check_non_rh_repository.rb +2 -2
- data/definitions/features/capsule.rb +2 -1
- data/definitions/features/foreman_proxy.rb +33 -6
- data/definitions/features/foreman_server.rb +1 -1
- data/definitions/features/installer.rb +4 -0
- data/definitions/procedures/backup/prepare_directory.rb +8 -1
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +1 -1
- data/definitions/procedures/content/prepare.rb +5 -0
- data/definitions/procedures/content/switchover.rb +7 -1
- data/definitions/procedures/foreman/remove_duplicate_permissions.rb +70 -0
- data/definitions/procedures/installer/upgrade.rb +1 -1
- data/definitions/procedures/packages/locking_status.rb +1 -1
- data/definitions/scenarios/content.rb +8 -2
- data/definitions/scenarios/packages.rb +4 -1
- data/definitions/scenarios/restore.rb +13 -0
- data/definitions/scenarios/upgrade_to_satellite_6_8.rb +1 -0
- data/extras/foreman_protector/foreman-protector.py +1 -1
- data/lib/foreman_maintain.rb +7 -1
- data/lib/foreman_maintain/cli/packages_command.rb +1 -1
- data/lib/foreman_maintain/cli/restore_command.rb +2 -1
- data/lib/foreman_maintain/cli/upgrade_command.rb +3 -0
- data/lib/foreman_maintain/concerns/base_database.rb +1 -1
- data/lib/foreman_maintain/concerns/downstream.rb +12 -14
- data/lib/foreman_maintain/reporter/cli_reporter.rb +1 -1
- data/lib/foreman_maintain/runner.rb +1 -0
- data/lib/foreman_maintain/scenario.rb +5 -2
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +8 -5
- data/definitions/scenarios/upgrade_to_capsule_6_7.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_7_z.rb +0 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e382b3653ec4332ef6bc891b83e92263874dfc079fb84c1f3db951696804832e
|
4
|
+
data.tar.gz: 03b8467289528688c03ed6ad7b8361befee931c9eb0d51a897aa38a755b9ad8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f9b4071adbda3fb4f39c84a6c02891aa4e54c0138d8245dfb2da93844bbc6b51e8db88a0424a006fde8563b7b4806b833176caeacaaa9c4b3101ef23824c4f0
|
7
|
+
data.tar.gz: a00abc28ccc812b76de1ca75849f471bd16944fb3cd8bc7ead833f0c077c17e1860626ba6e9c52af834fa1f21c2a6c6b0c331551bc435d921926fdc694cda045
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Foreman Maintenance [](https://travis-ci.org/theforeman/foreman_maintain) <a href="https://codeclimate.com/github/theforeman/foreman_maintain"><img src="https://codeclimate.com/github/theforeman/foreman_maintain/badges/gpa.svg" /></a>
|
2
2
|
|
3
|
-
`foreman_maintain` aims to provide various features that helps keep the
|
3
|
+
The `foreman_maintain` aims to provide various features that helps keep the
|
4
4
|
Foreman/Satellite up and running. It supports multiple versions and subparts
|
5
5
|
of the Foreman infrastructure, including server or smart proxy and is smart
|
6
6
|
enough to provide the right tools for the specific version.
|
@@ -19,8 +19,10 @@ Subcommands:
|
|
19
19
|
upgrade Upgrade related commands
|
20
20
|
list-versions List versions this system is upgradable to
|
21
21
|
check --target-version TARGET_VERSION Run pre-upgrade checks for upgrading to specified version
|
22
|
+
--disable-self-upgrade Disable automatic self upgrade (default: false)
|
22
23
|
run --target-version TARGET_VERSION Run the full upgrade
|
23
24
|
[--phase=phase TARGET_VERSION] Run just a specific phase of the upgrade
|
25
|
+
--disable-self-upgrade Disable automatic self upgrade (default: false)
|
24
26
|
|
25
27
|
advanced Advanced tools for server maintenance
|
26
28
|
procedure Run maintain procedures manually
|
@@ -59,8 +61,8 @@ Subcommands:
|
|
59
61
|
Foreman-maintain implements upgrade tooling that helps the administrator to go
|
60
62
|
through the upgrade process.
|
61
63
|
|
62
|
-
Foreman-maintain scans the system to know, what
|
63
|
-
|
64
|
+
Foreman-maintain scans the system to know, what versions are available
|
65
|
+
for upgrade on the particular system. To see what versions are available
|
64
66
|
for upgrade, run:
|
65
67
|
|
66
68
|
```
|
@@ -88,13 +90,13 @@ of the system:
|
|
88
90
|
|
89
91
|
* **pre-migrations** - these steps perform changes on the system before
|
90
92
|
the actual upgrade starts. An example is disabling access to the system from
|
91
|
-
external sources, a.k.a. maintenance mode or disabling sync plans during the run.
|
93
|
+
external sources, a.k.a. maintenance mode or disabling Katello sync plans during the run.
|
92
94
|
|
93
95
|
After this phase ends, the system is still running the old version, and it's possible
|
94
96
|
to revert the changes by running the post-migrations steps.
|
95
97
|
|
96
98
|
* **migrations** - this phase performs the actual migrations, starting with
|
97
|
-
configuring new repositories,
|
99
|
+
configuring new repositories, updating the packages and running the installer.
|
98
100
|
|
99
101
|
At the end of this phase, the system should be fully migrated to the new version.
|
100
102
|
However, the system is not fully operational yet, as the post-migrations steps
|
@@ -103,7 +105,7 @@ of the system:
|
|
103
105
|
* **post-migrations** - these steps revert the changes made in pre-migrations phase,
|
104
106
|
turning the system into fully-operational again.
|
105
107
|
|
106
|
-
* **post-upgrade checks** -
|
108
|
+
* **post-upgrade checks** - these steps should perform sanity check of the system
|
107
109
|
to ensure the system is valid and ready to be used again.
|
108
110
|
|
109
111
|
|
@@ -114,6 +116,40 @@ the *pre-upgrade check* phase. In case the upgrade failed before **migrations**
|
|
114
116
|
phase made some modifying changes, the tool tries to rollback to the previous
|
115
117
|
state of the system.
|
116
118
|
|
119
|
+
#### Self-upgrade for rubygem-foreman_maintain package
|
120
|
+
|
121
|
+
**Note:** This feature is available from `rubygem-foreman_maintain` version 0.6.4 and newer.
|
122
|
+
|
123
|
+
When a user runs any `foreman-maintain upgrade` sub commands (e.g. `foreman-maintain upgrade check` or `foreman-maintain upgrade run`) then,
|
124
|
+
|
125
|
+
* If update available for `rubygem-foreman_maintain` package, the sub command tries to update this package. After successful package update, it returns the exit code 75 and requests user to re-run with the updated source code.
|
126
|
+
|
127
|
+
Here, exit code (value 75) is to indicate that it can not continue with further execution & needs re-run. e.g.,
|
128
|
+
|
129
|
+
~~~
|
130
|
+
# foreman-maintain upgrade check --target-version TARGET_VERSION
|
131
|
+
Checking for new version of foreman-maintain...
|
132
|
+
rubygem-foreman_maintain.noarch repository
|
133
|
+
|
134
|
+
Updating foreman-maintain package.
|
135
|
+
|
136
|
+
The foreman-maintain package successfully updated.
|
137
|
+
|
138
|
+
Re-run foreman-maintain with required options!
|
139
|
+
|
140
|
+
# echo $?
|
141
|
+
75
|
142
|
+
~~~
|
143
|
+
|
144
|
+
* If update is not available for `rubygem-foreman_maintain` package, then sub command simply executes the further steps without halt.
|
145
|
+
|
146
|
+
* If user wants to skip self-update mechanism then `--disable-self-upgrade` flag can be used with upgrade sub commands. e.g.,
|
147
|
+
|
148
|
+
~~~
|
149
|
+
# foreman-maintain upgrade check --target-version TARGET_VERSION --disable-self-upgrade
|
150
|
+
# foreman-maintain upgrade run --target-version TARGET_VERSION --disable-self-upgrade
|
151
|
+
~~~
|
152
|
+
|
117
153
|
#### Satellite notes
|
118
154
|
|
119
155
|
To use custom organization/activation key for configuring repositories during
|
@@ -132,7 +168,7 @@ export FOREMAN_MAINTAIN_USE_BETA='1'
|
|
132
168
|
|
133
169
|
## Implementation
|
134
170
|
|
135
|
-
`foreman_maintain` maps the CLI commands into definitions. This allows to keep the set
|
171
|
+
The `foreman_maintain` maps the CLI commands into definitions. This allows to keep the set
|
136
172
|
of the commands the user needs to know immutable from version-specific changes. The mapping
|
137
173
|
between the CLI commands and definitions is made by defining various metadata.
|
138
174
|
|
@@ -329,8 +365,8 @@ end
|
|
329
365
|
```
|
330
366
|
|
331
367
|
Before executing the command the feature checks if it has valid hammer configuration to run the command.
|
332
|
-
Foreman maintain always use the 'admin' account to run the commands. The password is taken
|
333
|
-
the
|
368
|
+
Foreman maintain always use the 'admin' account to run the commands. The password is taken from
|
369
|
+
the hammer config or installer answer files or asked from the user interactively (in this order).
|
334
370
|
The valid credentials are stored and reused next time if still valid.
|
335
371
|
|
336
372
|
Usually we want to do the user interaction at the beginning of our scenario.
|
@@ -449,9 +485,18 @@ Possible options for the `:completion` attribute are:
|
|
449
485
|
* `maintenance-mode is-enabled` returns `0 or 1` output depending upon the maintenance-mode status.
|
450
486
|
Here, 0=ON & 1=OFF.
|
451
487
|
|
452
|
-
If
|
488
|
+
If users would like to check whether maintenance-mode is ON/OFF on system in their external script then
|
453
489
|
they can use subcommand `foreman-maintain maintenance-mode is-enabled`.
|
454
490
|
|
491
|
+
## Exit codes with special meanings -
|
492
|
+
|
493
|
+
Every command returns an exit code. Any other exit status than 0 indicates a failure of some kind. Foreman Maintain uses following exit codes with special meaning.
|
494
|
+
|
495
|
+
| Exit Code | Description |
|
496
|
+
| -----------| -----------------------------------|
|
497
|
+
| 75 | Temporary failure and needs re-run |
|
498
|
+
| 78 | Command executed with warning(s) |
|
499
|
+
|
455
500
|
## How to contribute?
|
456
501
|
|
457
502
|
Generally, follow the [Foreman guidelines](https://theforeman.org/contribute.html). For code-related contributions, fork this project and send a pull request with all changes. Some things to keep in mind:
|
@@ -13,7 +13,8 @@ require 'foreman_maintain/utils/bash'
|
|
13
13
|
# rubocop:disable Lint/RescueWithoutErrorClass, Lint/HandleExceptions
|
14
14
|
def cache_file(config_file)
|
15
15
|
config = YAML.load(File.open(config_file))
|
16
|
-
config
|
16
|
+
config.fetch(:completion_cache_file,
|
17
|
+
"#{ENV['HOME'] || '/root'}/.cache/foreman_maintain_completion.yml")
|
17
18
|
rescue
|
18
19
|
end
|
19
20
|
# rubocop:enable Lint/RescueWithoutErrorClass, Lint/HandleExceptions
|
@@ -23,7 +24,7 @@ config_file = if File.exist?(CONFIG_FILE)
|
|
23
24
|
else
|
24
25
|
File.join(project_root, 'config/foreman_maintain.yml')
|
25
26
|
end
|
26
|
-
completion_cache_file = cache_file(config_file)
|
27
|
+
completion_cache_file = cache_file(config_file)
|
27
28
|
completion_cache_file = File.expand_path(completion_cache_file)
|
28
29
|
|
29
30
|
# build the cache if it does not exist
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Checks::EnvProxy < ForemanMaintain::Check
|
2
|
+
metadata do
|
3
|
+
label :env_proxy
|
4
|
+
tags :env_proxy
|
5
|
+
description 'Check to make sure no HTTP(S) proxy set in ENV'
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
variables = %w[http_proxy https_proxy HTTP_PROXY HTTPS_PROXY]
|
10
|
+
has_proxy_set = true if variables.map { |variable| ENV[variable] }.compact.any?
|
11
|
+
assert(!has_proxy_set, 'Global HTTP(S) proxy in environment (env) is set. Please unset first!')
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Checks
|
2
|
+
module Foreman
|
3
|
+
class CheckpointSegments < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
label :check_postgresql_checkpoint_segments
|
6
|
+
description 'Check if checkpoint_segments configuration exists on the system'
|
7
|
+
confine do
|
8
|
+
feature(:foreman) && feature(:installer) &&
|
9
|
+
File.exist?(feature(:installer).custom_hiera_file)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
failure_message = check_custom_hiera
|
15
|
+
fail! failure_message if failure_message
|
16
|
+
end
|
17
|
+
|
18
|
+
# rubocop:disable Metrics/MethodLength
|
19
|
+
def check_custom_hiera
|
20
|
+
hiera_file = feature(:installer).custom_hiera_file
|
21
|
+
if (config = YAML.load_file(hiera_file)) &&
|
22
|
+
config.key?('postgresql::server::config_entries')
|
23
|
+
if config['postgresql::server::config_entries'].nil?
|
24
|
+
return <<-MESSAGE.strip_heredoc
|
25
|
+
ERROR: 'postgresql::server::config_entries' cannot be null.
|
26
|
+
Please remove it from following file and re-run the command.
|
27
|
+
- #{hiera_file}
|
28
|
+
MESSAGE
|
29
|
+
elsif config['postgresql::server::config_entries'].key?('checkpoint_segments')
|
30
|
+
message = <<-MESSAGE.strip_heredoc
|
31
|
+
ERROR: Tuning option 'checkpoint_segments' found.
|
32
|
+
This option is no longer valid for PostgreSQL 9.5 or newer.
|
33
|
+
Please remove it from following file and re-run the command.
|
34
|
+
- #{hiera_file}
|
35
|
+
MESSAGE
|
36
|
+
if feature(:katello)
|
37
|
+
message += <<-MESSAGE.strip_heredoc
|
38
|
+
The presence of checkpoint_segments in #{hiera_file} indicates manual tuning.
|
39
|
+
Manual tuning can override values provided by the --tuning parameter.
|
40
|
+
Review #{hiera_file} for values that are already provided by the built in tuning profiles.
|
41
|
+
Built in tuning profiles also provide a supported upgrade path.
|
42
|
+
MESSAGE
|
43
|
+
end
|
44
|
+
return message
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
# rubocop:enable Metrics/MethodLength
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Checks
|
2
|
+
module Foreman
|
3
|
+
class CheckDuplicatePermissions < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
label :duplicate_permissions
|
6
|
+
for_feature :foreman_database
|
7
|
+
description 'Check for duplicate permissions from database'
|
8
|
+
tags :pre_upgrade
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
duplicate_permissions = find_duplicate_permissions
|
13
|
+
assert(
|
14
|
+
duplicate_permissions.empty?,
|
15
|
+
'Duplicate permissions in your database',
|
16
|
+
:next_steps => [
|
17
|
+
Procedures::Foreman::RemoveDuplicatePermissions.new
|
18
|
+
]
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_duplicate_permissions
|
23
|
+
feature(:foreman_database).query(self.class.query_to_get_duplicate_permission)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.query_to_get_duplicate_permission
|
27
|
+
<<-SQL
|
28
|
+
SELECT id,name FROM permissions p WHERE (SELECT count(name) FROM permissions pr WHERE p.name =pr.name) > 1
|
29
|
+
SQL
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Checks::ForemanProxy
|
2
|
+
class CheckTftpStorage < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
label :check_tftp_storage
|
5
|
+
description 'Clean old Kernel and initramfs files from tftp-boot'
|
6
|
+
tags :default
|
7
|
+
confine do
|
8
|
+
feature(:satellite) && feature(:foreman_proxy) &&
|
9
|
+
feature(:foreman_proxy).features.include?('tftp') && non_zero_token_duration?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
if Dir.exist?(tftp_boot_directory)
|
15
|
+
files = old_files_from_tftp_boot
|
16
|
+
assert(files.empty?,
|
17
|
+
'There are old initrd and vmlinuz files present in tftp',
|
18
|
+
:next_steps => Procedures::Files::Remove.new(:files => files))
|
19
|
+
else
|
20
|
+
skip "TFTP #{tftp_boot_directory} directory doesn't exist."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def old_files_from_tftp_boot
|
25
|
+
Dir.glob("#{tftp_boot_directory}*-{vmlinuz,initrd.img}").map do |file|
|
26
|
+
unless File.directory?(file)
|
27
|
+
file if File.mtime(file) + (token_duration * 60) < Time.now
|
28
|
+
end
|
29
|
+
end.compact
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.non_zero_token_duration?
|
33
|
+
lookup_token_duration != 0
|
34
|
+
end
|
35
|
+
|
36
|
+
def tftp_boot_directory
|
37
|
+
@tftp_boot_directory ||= "#{feature(:foreman_proxy).tftp_root_directory}/boot/"
|
38
|
+
end
|
39
|
+
|
40
|
+
def token_duration
|
41
|
+
@token_duration ||= self.class.lookup_token_duration
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.lookup_token_duration
|
45
|
+
data = feature(:foreman_database). \
|
46
|
+
query("select s.value, s.default from settings s \
|
47
|
+
where category = 'Setting::Provisioning' and name = 'token_duration'")
|
48
|
+
YAML.load(data[0]['value'] || data[0]['default'])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -4,20 +4,18 @@ module Checks::ForemanProxy
|
|
4
4
|
description 'Check for verifying syntax for ISP DHCP configurations'
|
5
5
|
tags :default
|
6
6
|
confine do
|
7
|
-
feature(:foreman_proxy)
|
7
|
+
feature(:foreman_proxy) &&
|
8
|
+
feature(:foreman_proxy).features.include?('dhcp') &&
|
9
|
+
feature(:foreman_proxy).dhcp_isc_provider?
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
11
13
|
def run
|
12
|
-
if feature(:foreman_proxy).
|
13
|
-
|
14
|
-
|
15
|
-
assert(success, 'Please check and verify DHCP configurations.')
|
16
|
-
else
|
17
|
-
fail! "Couldn't find configuration file at #{feature(:foreman_proxy).dhcpd_config_file}"
|
18
|
-
end
|
14
|
+
if feature(:foreman_proxy).dhcpd_conf_exist?
|
15
|
+
success = feature(:foreman_proxy).valid_dhcp_configs?
|
16
|
+
assert(success, 'Please check and verify DHCP configurations.')
|
19
17
|
else
|
20
|
-
|
18
|
+
fail! "Couldn't find configuration file at #{feature(:foreman_proxy).dhcpd_config_file}"
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -2,7 +2,7 @@ module Checks::Repositories
|
|
2
2
|
class CheckNonRhRepository < ForemanMaintain::Check
|
3
3
|
metadata do
|
4
4
|
label :check_non_redhat_repository
|
5
|
-
description
|
5
|
+
description 'Check whether system has any non Red Hat repositories (e.g.: EPEL) enabled'
|
6
6
|
tags :pre_upgrade
|
7
7
|
confine do
|
8
8
|
feature(:instance).downstream
|
@@ -11,7 +11,7 @@ module Checks::Repositories
|
|
11
11
|
|
12
12
|
def run
|
13
13
|
with_spinner('Checking repositories enabled on the system') do
|
14
|
-
assert(!epel_enabled?, 'System is subscribed to non Red Hat repositories
|
14
|
+
assert(!epel_enabled?, 'System is subscribed to non Red Hat repositories')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -5,7 +5,8 @@ class Features::Capsule < ForemanMaintain::Feature
|
|
5
5
|
label :capsule
|
6
6
|
|
7
7
|
confine do
|
8
|
-
package_manager.installed?(['satellite
|
8
|
+
!package_manager.installed?(['satellite']) &&
|
9
|
+
package_manager.installed?(['satellite-capsule']) ||
|
9
10
|
package_manager.installed?(['capsule-installer'])
|
10
11
|
end
|
11
12
|
end
|
@@ -12,6 +12,9 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
12
12
|
FOREMAN_PROXY_DHCP_YML_PATHS = ['/etc/foreman-proxy/settings.d/dhcp.yml',
|
13
13
|
'/usr/local/etc/foreman-proxy/settings.d/dhcp.yml'].freeze
|
14
14
|
|
15
|
+
FOREMAN_PROXY_TFTP_YML_PATHS = ['/etc/foreman-proxy/settings.d/tftp.yml',
|
16
|
+
'/usr/local/etc/foreman-proxy/settings.d/tftp.yml'].freeze
|
17
|
+
|
15
18
|
def valid_dhcp_configs?
|
16
19
|
dhcp_req_pass? && !syntax_error_exists?
|
17
20
|
end
|
@@ -66,7 +69,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
66
69
|
|
67
70
|
configs.push('/var/lib/tftpboot') if backup_features.include?('tftp')
|
68
71
|
configs += ['/var/named/', '/etc/named*'] if backup_features.include?('dns')
|
69
|
-
if backup_features.include?('dhcp')
|
72
|
+
if backup_features.include?('dhcp') && dhcp_isc_provider?
|
70
73
|
configs += ['/var/lib/dhcpd', File.dirname(dhcpd_config_file)]
|
71
74
|
end
|
72
75
|
configs.push('/usr/share/xml/scap') if backup_features.include?('openscap')
|
@@ -98,7 +101,9 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
98
101
|
end
|
99
102
|
|
100
103
|
def certs_tar
|
101
|
-
|
104
|
+
if content_module
|
105
|
+
feature(:installer).answers.fetch(content_module, {})[certs_param_name[:param_key]]
|
106
|
+
end
|
102
107
|
end
|
103
108
|
|
104
109
|
def settings_file
|
@@ -113,6 +118,14 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
113
118
|
@dhcpd_config_file ||= lookup_dhcpd_config_file
|
114
119
|
end
|
115
120
|
|
121
|
+
def tftp_root_directory
|
122
|
+
@tftp_root_directory ||= lookup_tftp_root_directory
|
123
|
+
end
|
124
|
+
|
125
|
+
def dhcp_isc_provider?
|
126
|
+
configs_from_dhcp_yml[:use_provider] == 'dhcp_isc'
|
127
|
+
end
|
128
|
+
|
116
129
|
private
|
117
130
|
|
118
131
|
def backup_features(for_features)
|
@@ -209,11 +222,18 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
209
222
|
dhcpd_config_file
|
210
223
|
end
|
211
224
|
|
212
|
-
def
|
213
|
-
|
214
|
-
raise "Couldn't find dhcp.yml file under foreman-proxy" unless
|
225
|
+
def dhcp_yml_path
|
226
|
+
dhcp_path = lookup_into(FOREMAN_PROXY_DHCP_YML_PATHS)
|
227
|
+
raise "Couldn't find dhcp.yml file under foreman-proxy" unless dhcp_path
|
215
228
|
|
216
|
-
|
229
|
+
dhcp_path
|
230
|
+
end
|
231
|
+
|
232
|
+
def configs_from_dhcp_yml
|
233
|
+
@configs_from_dhcp_yml ||= yaml_load(dhcp_yml_path)
|
234
|
+
end
|
235
|
+
|
236
|
+
def lookup_using_dhcp_yml
|
217
237
|
if configs_from_dhcp_yml.key?(:dhcp_config)
|
218
238
|
return configs_from_dhcp_yml[:dhcp_config]
|
219
239
|
elsif configs_from_dhcp_yml.key?(:use_provider)
|
@@ -226,6 +246,13 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
226
246
|
end
|
227
247
|
end
|
228
248
|
|
249
|
+
def lookup_tftp_root_directory
|
250
|
+
tftp_yml_path = lookup_into(FOREMAN_PROXY_TFTP_YML_PATHS)
|
251
|
+
raise "Couldn't find tftp.yml file under foreman-proxy" unless tftp_yml_path
|
252
|
+
|
253
|
+
yaml_load(tftp_yml_path)[:tftproot]
|
254
|
+
end
|
255
|
+
|
229
256
|
def yaml_load(path)
|
230
257
|
YAML.load_file(path) || {}
|
231
258
|
end
|
@@ -53,6 +53,10 @@ class Features::Installer < ForemanMaintain::Feature
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
def custom_hiera_file
|
57
|
+
@custom_hiera_file ||= File.join(config_directory, 'custom-hiera.yaml')
|
58
|
+
end
|
59
|
+
|
56
60
|
def can_upgrade?
|
57
61
|
@installer_type == :scenarios || @installer_type == :legacy_katello
|
58
62
|
end
|
@@ -8,6 +8,7 @@ module Procedures::Backup
|
|
8
8
|
param :incremental_dir, 'Changes since specified backup only'
|
9
9
|
end
|
10
10
|
|
11
|
+
# rubocop:disable Metrics/MethodLength
|
11
12
|
def run
|
12
13
|
puts "Creating backup folder #{@backup_dir}"
|
13
14
|
|
@@ -22,8 +23,14 @@ module Procedures::Backup
|
|
22
23
|
|
23
24
|
FileUtils.rm(Dir.glob(File.join(@backup_dir, '.*.snar'))) if @preserve_dir
|
24
25
|
if @incremental_dir
|
25
|
-
|
26
|
+
if (snar_files = Dir.glob(File.join(@incremental_dir, '.*.snar'))).empty?
|
27
|
+
raise "#{@incremental_dir}/*.snar files unavailable. "\
|
28
|
+
'Provide a valid previous backup directory'
|
29
|
+
else
|
30
|
+
FileUtils.cp(snar_files, @backup_dir)
|
31
|
+
end
|
26
32
|
end
|
27
33
|
end
|
34
|
+
# rubocop:enable Metrics/MethodLength
|
28
35
|
end
|
29
36
|
end
|
@@ -12,7 +12,7 @@ module Procedures::Backup
|
|
12
12
|
backup_lv = get_lv_info(@backup_dir)
|
13
13
|
|
14
14
|
dbs = {}
|
15
|
-
dbs[:
|
15
|
+
dbs[:pulp2] = 'Pulp' if feature(:pulp2) && !@skip_pulp
|
16
16
|
dbs[:mongo] = 'Mongo' if db_local?(:mongo)
|
17
17
|
dbs[:candlepin_database] = 'Candlepin' if db_local?(:candlepin_database)
|
18
18
|
dbs[:foreman_database] = 'Foreman' if db_local?(:foreman_database)
|
@@ -3,6 +3,11 @@ module Procedures::Content
|
|
3
3
|
metadata do
|
4
4
|
description 'Switch support for certain content from Pulp 2 to Pulp 3'
|
5
5
|
for_feature :pulpcore
|
6
|
+
|
7
|
+
confine do
|
8
|
+
# FIXME: remove this condition on next downstream upgrade scenario
|
9
|
+
!feature(:instance).downstream
|
10
|
+
end
|
6
11
|
end
|
7
12
|
|
8
13
|
def run
|
@@ -15,7 +20,8 @@ module Procedures::Content
|
|
15
20
|
puts 'Re-running the installer to switch specified content over to pulp3'
|
16
21
|
args = ['--foreman-proxy-content-proxy-pulp-isos-to-pulpcore=true',
|
17
22
|
'--katello-use-pulp-2-for-file=false',
|
18
|
-
'--katello-use-pulp-2-for-docker=false'
|
23
|
+
'--katello-use-pulp-2-for-docker=false',
|
24
|
+
'--katello-use-pulp-2-for-yum=false']
|
19
25
|
feature(:installer).run(args.join(' '))
|
20
26
|
end
|
21
27
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Procedures::Foreman
|
2
|
+
class RemoveDuplicatePermissions < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
for_feature :foreman_database
|
5
|
+
description 'Remove duplicate permissions from database'
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
duplicate_permissions = feature(:foreman_database).query(
|
10
|
+
Checks::Foreman::CheckDuplicatePermissions.query_to_get_duplicate_permission
|
11
|
+
).group_by { |permission| permission['name'] }
|
12
|
+
unassigned_permissions = []
|
13
|
+
duplicate_permissions.each_value do |permissions|
|
14
|
+
permission_ids = permissions.map { |i| i['id'] }
|
15
|
+
filterings = check_permissions_assign_to_filter(permission_ids)
|
16
|
+
assigned_permissions = filterings.keys
|
17
|
+
unassigned_permissions << permission_ids - assigned_permissions
|
18
|
+
fix_permissions(assigned_permissions) if assigned_permissions.length > 1
|
19
|
+
end
|
20
|
+
delete_permission(unassigned_permissions.flatten) unless unassigned_permissions.empty?
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def check_permissions_assign_to_filter(permission_ids)
|
26
|
+
sql = <<-SQL
|
27
|
+
SELECT id, filter_id, permission_id FROM filterings WHERE permission_id IN (#{permission_ids.join(',')})
|
28
|
+
SQL
|
29
|
+
feature(:foreman_database).query(sql).group_by { |filtering| filtering['permission_id'] }
|
30
|
+
end
|
31
|
+
|
32
|
+
def fix_permissions(assigned_permissions)
|
33
|
+
persist_permission = assigned_permissions.shift
|
34
|
+
filter_ids = filters_for_permission(persist_permission)
|
35
|
+
update_filtering(assigned_permissions, persist_permission, filter_ids)
|
36
|
+
delete_filtering(assigned_permissions)
|
37
|
+
delete_permission(assigned_permissions)
|
38
|
+
end
|
39
|
+
|
40
|
+
def filters_for_permission(permission)
|
41
|
+
feature(:foreman_database).query(
|
42
|
+
"SELECT filter_id FROM filterings WHERE permission_id = #{permission.to_i}"
|
43
|
+
).map { |filter| filter['filter_id'] }
|
44
|
+
end
|
45
|
+
|
46
|
+
def update_filtering(old_ids, new_id, filter_ids)
|
47
|
+
sql = <<-SQL
|
48
|
+
WITH rows AS (
|
49
|
+
UPDATE filterings SET permission_id = '#{new_id}' WHERE permission_id IN (#{old_ids.join(',')}) AND filter_id NOT IN (#{filter_ids.join(',')})
|
50
|
+
RETURNING id
|
51
|
+
)
|
52
|
+
SELECT id
|
53
|
+
FROM rows
|
54
|
+
SQL
|
55
|
+
feature(:foreman_database).query(sql)
|
56
|
+
end
|
57
|
+
|
58
|
+
def delete_filtering(permission_ids)
|
59
|
+
feature(:foreman_database).psql(
|
60
|
+
"DELETE FROM filterings where permission_id IN (#{permission_ids.join(',')})"
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def delete_permission(permission_ids)
|
65
|
+
feature(:foreman_database).psql(
|
66
|
+
"DELETE FROM permissions where id IN (#{permission_ids.join(',')})"
|
67
|
+
)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -18,7 +18,7 @@ module Procedures::Packages
|
|
18
18
|
else
|
19
19
|
puts ' Packages are not locked.'
|
20
20
|
puts " WARNING: When locking is disabled there is a risk of unwanted update\n" \
|
21
|
-
" of #{feature(:instance).product_name}
|
21
|
+
" of #{feature(:instance).product_name} and its components and possible " \
|
22
22
|
'data inconsistency'
|
23
23
|
end
|
24
24
|
end
|
@@ -8,7 +8,10 @@ module ForemanMaintain::Scenarios
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def compose
|
11
|
-
|
11
|
+
# FIXME: remove this condition on next downstream upgrade scenario
|
12
|
+
if Procedures::Content::Prepare.present?
|
13
|
+
add_step(Procedures::Content::Prepare)
|
14
|
+
end
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
@@ -20,7 +23,10 @@ module ForemanMaintain::Scenarios
|
|
20
23
|
end
|
21
24
|
|
22
25
|
def compose
|
23
|
-
|
26
|
+
# FIXME: remove this condition on next downstream upgrade scenario
|
27
|
+
if Procedures::Content::Switchover.present?
|
28
|
+
add_step(Procedures::Content::Switchover)
|
29
|
+
end
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
@@ -1,7 +1,10 @@
|
|
1
1
|
module ForemanMaintain::Scenarios
|
2
2
|
module Packages
|
3
3
|
def self.skip_installer_run?(packages_list)
|
4
|
-
|
4
|
+
if packages_list.is_a?(String)
|
5
|
+
packages_list = packages_list.split(',').map(&:strip)
|
6
|
+
end
|
7
|
+
packages_list ||= []
|
5
8
|
|
6
9
|
return false unless packages_list.any? { |p| p.include?('foreman_maintain') }
|
7
10
|
return true if packages_list.length == 1
|
@@ -20,6 +20,7 @@ module ForemanMaintain::Scenarios
|
|
20
20
|
Checks::Restore::ValidateHostname,
|
21
21
|
Procedures::Selinux::SetFileSecurity,
|
22
22
|
Procedures::Restore::Configs)
|
23
|
+
add_step_with_context(Procedures::Crond::Stop) if feature(:cron)
|
23
24
|
unless backup.incremental?
|
24
25
|
add_steps_with_context(Procedures::Restore::EnsureMongoEngineMatches,
|
25
26
|
Procedures::Restore::InstallerReset)
|
@@ -41,6 +42,7 @@ module ForemanMaintain::Scenarios
|
|
41
42
|
add_steps_with_context(Procedures::Restore::RegenerateQueues) if backup.online_backup?
|
42
43
|
add_steps_with_context(Procedures::Service::Start,
|
43
44
|
Procedures::Service::DaemonReload)
|
45
|
+
add_step_with_context(Procedures::Crond::Start) if feature(:cron)
|
44
46
|
end
|
45
47
|
# rubocop:enable Metrics/MethodLength,Metrics/AbcSize
|
46
48
|
|
@@ -98,4 +100,15 @@ module ForemanMaintain::Scenarios
|
|
98
100
|
Procedures::Selinux::SetFileSecurity => :incremental_backup)
|
99
101
|
end
|
100
102
|
end
|
103
|
+
|
104
|
+
class RestoreRescue < ForemanMaintain::Scenario
|
105
|
+
metadata do
|
106
|
+
description 'Resuce Restore backup'
|
107
|
+
manual_detection
|
108
|
+
end
|
109
|
+
|
110
|
+
def compose
|
111
|
+
add_step_with_context(Procedures::Crond::Stop) if feature(:cron)
|
112
|
+
end
|
113
|
+
end
|
101
114
|
end
|
@@ -26,7 +26,7 @@ def _load_whitelist():
|
|
26
26
|
continue
|
27
27
|
_package_whitelist.add(line.rstrip().lower())
|
28
28
|
llfile.close()
|
29
|
-
except urlgrabber.grabber.URLGrabError
|
29
|
+
except urlgrabber.grabber.URLGrabError as e:
|
30
30
|
raise PluginYumExit('Unable to read Foreman protector"s configuration: %s' % e)
|
31
31
|
|
32
32
|
def _add_obsoletes(conduit):
|
data/lib/foreman_maintain.rb
CHANGED
@@ -53,6 +53,8 @@ module ForemanMaintain
|
|
53
53
|
}.freeze
|
54
54
|
|
55
55
|
def setup(options = {})
|
56
|
+
set_home_environment
|
57
|
+
|
56
58
|
# using a queue, we can log the messages which are generated before initializing logger
|
57
59
|
self.config = Config.new(options)
|
58
60
|
load_definitions
|
@@ -60,6 +62,10 @@ module ForemanMaintain
|
|
60
62
|
update_path
|
61
63
|
end
|
62
64
|
|
65
|
+
def set_home_environment
|
66
|
+
ENV['HOME'] ||= '/root'
|
67
|
+
end
|
68
|
+
|
63
69
|
# Appending PATH with expected paths needed for commands we run
|
64
70
|
def update_path
|
65
71
|
paths = ['/sbin']
|
@@ -162,7 +168,7 @@ module ForemanMaintain
|
|
162
168
|
ForemanMaintain.package_manager.update(main_package_name, :assumeyes => true)
|
163
169
|
puts "\nThe #{package_name} package successfully updated."\
|
164
170
|
"\nRe-run #{command} with required options!"
|
165
|
-
exit
|
171
|
+
exit 75
|
166
172
|
end
|
167
173
|
puts "Nothing to update, can't find new version of #{package_name}."
|
168
174
|
end
|
@@ -38,7 +38,7 @@ module ForemanMaintain
|
|
38
38
|
|
39
39
|
subcommand 'update', 'Update packages in an unlocked session' do
|
40
40
|
interactive_option
|
41
|
-
parameter '[PACKAGES ...
|
41
|
+
parameter '[PACKAGES] ...', 'packages to update', :attribute_name => :packages
|
42
42
|
|
43
43
|
def execute
|
44
44
|
run_scenarios_and_exit(
|
@@ -13,7 +13,8 @@ module ForemanMaintain
|
|
13
13
|
:backup_dir => @backup_dir,
|
14
14
|
:incremental_backup => @incremental || incremental_backup?
|
15
15
|
)
|
16
|
-
|
16
|
+
rescue_scenario = Scenarios::RestoreRescue.new
|
17
|
+
run_scenario(scenario, rescue_scenario)
|
17
18
|
exit runner.exit_code
|
18
19
|
end
|
19
20
|
|
@@ -53,7 +53,10 @@ module ForemanMaintain
|
|
53
53
|
end
|
54
54
|
|
55
55
|
subcommand 'list-versions', 'List versions this system is upgradable to' do
|
56
|
+
disable_self_upgrade_option
|
57
|
+
|
56
58
|
def execute
|
59
|
+
ForemanMaintain.perform_self_upgrade unless disable_self_upgrade?
|
57
60
|
print_versions(UpgradeRunner.available_targets)
|
58
61
|
end
|
59
62
|
end
|
@@ -82,7 +82,7 @@ module ForemanMaintain
|
|
82
82
|
tar_options = {
|
83
83
|
:archive => backup_file,
|
84
84
|
:command => 'create',
|
85
|
-
:transform =>
|
85
|
+
:transform => "s,^,#{data_dir[1..-1]},S",
|
86
86
|
:files => '*'
|
87
87
|
}.merge(extra_tar_options)
|
88
88
|
feature(:tar).run(tar_options)
|
@@ -72,7 +72,9 @@ module ForemanMaintain
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def ansible_repo(server_version, rh_version_major)
|
75
|
-
if server_version >= version('6.
|
75
|
+
if server_version >= version('6.8')
|
76
|
+
"rhel-#{rh_version_major}-server-ansible-2.9-rpms"
|
77
|
+
elsif server_version >= version('6.6')
|
76
78
|
"rhel-#{rh_version_major}-server-ansible-2.8-rpms"
|
77
79
|
elsif server_version >= version('6.4')
|
78
80
|
"rhel-#{rh_version_major}-server-ansible-2.6-rpms"
|
@@ -97,21 +99,17 @@ module ForemanMaintain
|
|
97
99
|
end
|
98
100
|
|
99
101
|
def common_repos(rh_version_major, full_version)
|
100
|
-
repos_arrary =
|
101
|
-
|
102
|
+
repos_arrary = if ENV['FOREMAN_MAINTAIN_USE_BETA'] == '1'
|
103
|
+
["rhel-#{rh_version_major}-server-satellite-maintenance-6-beta-rpms",
|
104
|
+
"rhel-#{rh_version_major}-server-satellite-tools-6-beta-rpms"]
|
105
|
+
else
|
106
|
+
["rhel-#{rh_version_major}-server-satellite-maintenance-6-rpms",
|
107
|
+
"rhel-#{rh_version_major}-server-satellite-tools-#{full_version}-rpms"]
|
108
|
+
end
|
102
109
|
|
103
|
-
repos_arrary
|
104
|
-
end
|
105
|
-
|
106
|
-
def common_repos_array(rh_version_major, full_version)
|
107
|
-
["rhel-#{rh_version_major}-server-satellite-maintenance-6#{use_beta}-rpms",
|
108
|
-
"rhel-#{rh_version_major}-server-satellite-tools-#{full_version}#{use_beta}-rpms"]
|
109
|
-
end
|
110
|
-
|
111
|
-
def use_beta
|
112
|
-
return '-beta' if ENV['FOREMAN_MAINTAIN_USE_BETA'] == '1'
|
110
|
+
return repos_arrary.first(1) if feature(:satellite)
|
113
111
|
|
114
|
-
|
112
|
+
repos_arrary
|
115
113
|
end
|
116
114
|
|
117
115
|
def main_rh_repos(rh_version_major)
|
@@ -276,7 +276,7 @@ module ForemanMaintain
|
|
276
276
|
|
277
277
|
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
278
278
|
def scenario_failure_message(scenario)
|
279
|
-
return if scenario.passed?
|
279
|
+
return if scenario.passed? && !scenario.warning?
|
280
280
|
message = []
|
281
281
|
message << <<-MESSAGE.strip_heredoc
|
282
282
|
Scenario [#{scenario.description}] failed.
|
@@ -129,8 +129,11 @@ module ForemanMaintain
|
|
129
129
|
|
130
130
|
def passed?
|
131
131
|
(steps_with_abort(:whitelisted => false) +
|
132
|
-
steps_with_error(:whitelisted => false)
|
133
|
-
|
132
|
+
steps_with_error(:whitelisted => false)).empty?
|
133
|
+
end
|
134
|
+
|
135
|
+
def warning?
|
136
|
+
!steps_with_warning(:whitelisted => false).empty?
|
134
137
|
end
|
135
138
|
|
136
139
|
def failed?
|
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.6.
|
4
|
+
version: 0.6.10
|
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: 2020-
|
11
|
+
date: 2020-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -126,13 +126,17 @@ files:
|
|
126
126
|
- definitions/checks/check_tmout.rb
|
127
127
|
- definitions/checks/disk/available_space.rb
|
128
128
|
- definitions/checks/disk/performance.rb
|
129
|
+
- definitions/checks/env_proxy.rb
|
130
|
+
- definitions/checks/foreman/check_checkpoint_segments.rb
|
129
131
|
- definitions/checks/foreman/check_corrupted_roles.rb
|
132
|
+
- definitions/checks/foreman/check_duplicate_permission.rb
|
130
133
|
- definitions/checks/foreman/check_duplicate_roles.rb
|
131
134
|
- definitions/checks/foreman/db_up.rb
|
132
135
|
- definitions/checks/foreman/facts_names.rb
|
133
136
|
- definitions/checks/foreman/puppet_class_duplicates.rb
|
134
137
|
- definitions/checks/foreman/validate_external_db_version.rb
|
135
138
|
- definitions/checks/foreman_openscap/invalid_report_associations.rb
|
139
|
+
- definitions/checks/foreman_proxy/check_tftp_storage.rb
|
136
140
|
- definitions/checks/foreman_proxy/verify_dhcp_config_syntax.rb
|
137
141
|
- definitions/checks/foreman_tasks/invalid/check_old.rb
|
138
142
|
- definitions/checks/foreman_tasks/invalid/check_pending_state.rb
|
@@ -224,6 +228,7 @@ files:
|
|
224
228
|
- definitions/procedures/foreman/apipie_cache.rb
|
225
229
|
- definitions/procedures/foreman/fix_corrupted_roles.rb
|
226
230
|
- definitions/procedures/foreman/remove_duplicate_obsolete_roles.rb
|
231
|
+
- definitions/procedures/foreman/remove_duplicate_permissions.rb
|
227
232
|
- definitions/procedures/foreman_docker/remove_foreman_docker.rb
|
228
233
|
- definitions/procedures/foreman_openscap/invalid_report_associations.rb
|
229
234
|
- definitions/procedures/foreman_proxy/features.rb
|
@@ -284,8 +289,6 @@ files:
|
|
284
289
|
- definitions/scenarios/packages.rb
|
285
290
|
- definitions/scenarios/restore.rb
|
286
291
|
- definitions/scenarios/services.rb
|
287
|
-
- definitions/scenarios/upgrade_to_capsule_6_7.rb
|
288
|
-
- definitions/scenarios/upgrade_to_capsule_6_7_z.rb
|
289
292
|
- definitions/scenarios/upgrade_to_capsule_6_8.rb
|
290
293
|
- definitions/scenarios/upgrade_to_capsule_6_8_z.rb
|
291
294
|
- definitions/scenarios/upgrade_to_satellite_6_2.rb
|
@@ -401,7 +404,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
401
404
|
- !ruby/object:Gem::Version
|
402
405
|
version: '0'
|
403
406
|
requirements: []
|
404
|
-
rubygems_version: 3.0.
|
407
|
+
rubygems_version: 3.0.3
|
405
408
|
signing_key:
|
406
409
|
specification_version: 4
|
407
410
|
summary: Foreman maintenance tool belt
|
@@ -1,88 +0,0 @@
|
|
1
|
-
module Scenarios::Capsule_6_7
|
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.6' || \
|
9
|
-
ForemanMaintain.upgrade_in_progress == '6.7')
|
10
|
-
end
|
11
|
-
instance_eval(&block)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def target_version
|
16
|
-
'6.7'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class PreUpgradeCheck < Abstract
|
21
|
-
upgrade_metadata do
|
22
|
-
description 'Checks before upgrading to Capsule 6.7'
|
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::Repositories::Validate.new(:version => '6.7'))
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class PreMigrations < Abstract
|
35
|
-
upgrade_metadata do
|
36
|
-
description 'Procedures before migrating to Capsule 6.7'
|
37
|
-
tags :pre_migrations
|
38
|
-
end
|
39
|
-
|
40
|
-
def compose
|
41
|
-
add_steps(find_procedures(:pre_migrations))
|
42
|
-
add_step(Procedures::Service::Stop.new)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class Migrations < Abstract
|
47
|
-
upgrade_metadata do
|
48
|
-
description 'Migration scripts to Capsule 6.7'
|
49
|
-
tags :migrations
|
50
|
-
end
|
51
|
-
|
52
|
-
def set_context_mapping
|
53
|
-
context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
|
54
|
-
end
|
55
|
-
|
56
|
-
def compose
|
57
|
-
add_step(Procedures::Repositories::Setup.new(:version => '6.7'))
|
58
|
-
add_step(Procedures::Packages::UnlockVersions.new)
|
59
|
-
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
60
|
-
add_step_with_context(Procedures::Installer::Upgrade)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
class PostMigrations < Abstract
|
65
|
-
upgrade_metadata do
|
66
|
-
description 'Procedures after migrating to Capsule 6.7'
|
67
|
-
tags :post_migrations
|
68
|
-
end
|
69
|
-
|
70
|
-
def compose
|
71
|
-
add_step(Procedures::Service::Start.new)
|
72
|
-
add_steps(find_procedures(:post_migrations))
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
class PostUpgradeChecks < Abstract
|
77
|
-
upgrade_metadata do
|
78
|
-
description 'Checks after upgrading to Capsule 6.7'
|
79
|
-
tags :post_upgrade_checks
|
80
|
-
run_strategy :fail_slow
|
81
|
-
end
|
82
|
-
|
83
|
-
def compose
|
84
|
-
add_steps(find_checks(:default))
|
85
|
-
add_steps(find_checks(:post_upgrade))
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
module Scenarios::Capsule_6_7_z
|
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.7' || \
|
9
|
-
ForemanMaintain.upgrade_in_progress == '6.7.z')
|
10
|
-
end
|
11
|
-
instance_eval(&block)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def target_version
|
16
|
-
'6.7.z'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class PreUpgradeCheck < Abstract
|
21
|
-
upgrade_metadata do
|
22
|
-
description 'Checks before upgrading to Capsule 6.7.z'
|
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::Repositories::Validate.new(:version => '6.7'))
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class PreMigrations < Abstract
|
35
|
-
upgrade_metadata do
|
36
|
-
description 'Procedures before migrating to Capsule 6.7.z'
|
37
|
-
tags :pre_migrations
|
38
|
-
end
|
39
|
-
|
40
|
-
def compose
|
41
|
-
add_steps(find_procedures(:pre_migrations))
|
42
|
-
add_step(Procedures::Service::Stop.new)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class Migrations < Abstract
|
47
|
-
upgrade_metadata do
|
48
|
-
description 'Migration scripts to Capsule 6.7.z'
|
49
|
-
tags :migrations
|
50
|
-
end
|
51
|
-
|
52
|
-
def set_context_mapping
|
53
|
-
context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
|
54
|
-
end
|
55
|
-
|
56
|
-
def compose
|
57
|
-
add_step(Procedures::Repositories::Setup.new(:version => '6.7'))
|
58
|
-
add_step(Procedures::Packages::UnlockVersions.new)
|
59
|
-
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
60
|
-
add_step_with_context(Procedures::Installer::Upgrade)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
class PostMigrations < Abstract
|
65
|
-
upgrade_metadata do
|
66
|
-
description 'Procedures after migrating to Capsule 6.7.z'
|
67
|
-
tags :post_migrations
|
68
|
-
end
|
69
|
-
|
70
|
-
def compose
|
71
|
-
add_step(Procedures::Service::Start.new)
|
72
|
-
add_steps(find_procedures(:post_migrations))
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
class PostUpgradeChecks < Abstract
|
77
|
-
upgrade_metadata do
|
78
|
-
description 'Checks after upgrading to Capsule 6.7.z'
|
79
|
-
tags :post_upgrade_checks
|
80
|
-
run_strategy :fail_slow
|
81
|
-
end
|
82
|
-
|
83
|
-
def compose
|
84
|
-
add_steps(find_checks(:default))
|
85
|
-
add_steps(find_checks(:post_upgrade))
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|