foreman_maintain 0.8.30 → 0.8.31
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/procedures/packages/update.rb +3 -1
- data/definitions/scenarios/self_upgrade.rb +17 -53
- data/lib/foreman_maintain/cli/self_upgrade_command.rb +1 -7
- data/lib/foreman_maintain/concerns/system_helpers.rb +3 -2
- data/lib/foreman_maintain/package_manager/yum.rb +8 -4
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a60ab5a7e89c406aa5a1821ec0786f4a523e8ff099624c5f7e08fa1ea0c01e6
|
4
|
+
data.tar.gz: bda6f1436f8719c7c4888b07b494110101c06a3696f7d3cbf177f516d538e7db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1101a4af2af8e7d70bee47ac87cfbbf2f7c6eed2d47f0f61abd11995fc075c9314854520de7df3e8a2bce7447ea1557290c932aa82ff14ff2de08c11c65a8a66
|
7
|
+
data.tar.gz: 98256752a9d3b1e796ac7159eaea5751dffa1d7e54ada6a4b19c4aaca98896b1008c12985005c003db7d7b8d31731e29f88c72cdedb36b2df5865edf5da87ff6
|
@@ -6,12 +6,14 @@ 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 :yum_options, 'Extra yum options if any', :array => true, :default => []
|
9
10
|
end
|
10
11
|
|
11
12
|
def run
|
12
13
|
assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
|
13
14
|
package_manager.clean_cache(:assumeyes => assumeyes_val)
|
14
|
-
|
15
|
+
opts = { :assumeyes => assumeyes_val, :yum_options => @yum_options }
|
16
|
+
packages_action(:update, @packages, opts)
|
15
17
|
rescue ForemanMaintain::Error::ExecutionError => e
|
16
18
|
if @warn_on_errors
|
17
19
|
set_status(:warning, e.message)
|
@@ -1,17 +1,6 @@
|
|
1
1
|
module ForemanMaintain::Scenarios
|
2
2
|
class SelfUpgradeBase < ForemanMaintain::Scenario
|
3
|
-
|
4
|
-
feature(:system_repos).enabled_repos_ids
|
5
|
-
end
|
6
|
-
|
7
|
-
def enable_repos(repo_ids = stored_enabled_repos_ids)
|
8
|
-
add_step(Procedures::Repositories::Enable.new(repos: repo_ids))
|
9
|
-
end
|
10
|
-
|
11
|
-
def disable_repos(repo_ids = stored_enabled_repos_ids)
|
12
|
-
add_step(Procedures::Repositories::Disable.new(repos: repo_ids))
|
13
|
-
end
|
14
|
-
|
3
|
+
include ForemanMaintain::Concerns::Downstream
|
15
4
|
def target_version
|
16
5
|
current_full_version = feature(:instance).downstream.current_version
|
17
6
|
@target_version ||= current_full_version.bump
|
@@ -43,31 +32,22 @@ module ForemanMaintain::Scenarios
|
|
43
32
|
end
|
44
33
|
end
|
45
34
|
|
46
|
-
def
|
47
|
-
return
|
35
|
+
def use_rhsm?
|
36
|
+
return false if maintenance_repo_label
|
48
37
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
def stored_enabled_repos_ids
|
53
|
-
@stored_enabled_repos_ids ||= begin
|
54
|
-
path = File.expand_path('enabled_repos.yml', ForemanMaintain.config.backup_dir)
|
55
|
-
@stored_enabled_repos_ids = File.file?(path) ? YAML.load(File.read(path)) : []
|
38
|
+
if (repo = ENV['MAINTENANCE_REPO_LABEL'])
|
39
|
+
return false unless repo.empty?
|
56
40
|
end
|
57
|
-
end
|
58
41
|
|
59
|
-
|
60
|
-
repo_regex = if el7?
|
61
|
-
/rhel-\d-server-satellite-maintenance-\d.\d-rpms/
|
62
|
-
else
|
63
|
-
/satellite-maintenance-\d.\d-for-rhel-\d-x86_64-rpms/
|
64
|
-
end
|
65
|
-
stored_enabled_repos_ids.select { |id| !id.match(repo_regex).nil? }
|
42
|
+
true
|
66
43
|
end
|
67
44
|
|
68
|
-
def
|
69
|
-
|
70
|
-
|
45
|
+
def req_repos_to_update_pkgs
|
46
|
+
if use_rhsm?
|
47
|
+
main_rh_repos + [maintenance_repo_id(target_version)]
|
48
|
+
else
|
49
|
+
[maintenance_repo_id(target_version)]
|
50
|
+
end
|
71
51
|
end
|
72
52
|
end
|
73
53
|
|
@@ -82,27 +62,11 @@ module ForemanMaintain::Scenarios
|
|
82
62
|
def compose
|
83
63
|
if check_min_version('foreman', '2.5') || check_min_version('foreman-proxy', '2.5')
|
84
64
|
pkgs_to_update = %w[satellite-maintain rubygem-foreman_maintain]
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
class SelfUpgradeRescue < SelfUpgradeBase
|
95
|
-
metadata do
|
96
|
-
label :rescue_self_upgrade
|
97
|
-
description 'Disables all version specific maintenance repositories and,'\
|
98
|
-
"\nenables the repositories which were configured prior to self upgrade"
|
99
|
-
manual_detection
|
100
|
-
run_strategy :fail_slow
|
101
|
-
end
|
102
|
-
|
103
|
-
def compose
|
104
|
-
if check_min_version('foreman', '2.5') || check_min_version('foreman-proxy', '2.5')
|
105
|
-
enable_repos(repos_ids_to_reenable)
|
65
|
+
yum_options = req_repos_to_update_pkgs.map do |id|
|
66
|
+
"--enablerepo=#{id}"
|
67
|
+
end
|
68
|
+
add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true,
|
69
|
+
yum_options: yum_options))
|
106
70
|
end
|
107
71
|
end
|
108
72
|
end
|
@@ -5,7 +5,7 @@ module ForemanMaintain
|
|
5
5
|
'Repository label from which packages should be updated.'\
|
6
6
|
'This can be used when standard CDN repositories are unavailable.'
|
7
7
|
def execute
|
8
|
-
run_scenario(upgrade_scenario
|
8
|
+
run_scenario(upgrade_scenario)
|
9
9
|
end
|
10
10
|
|
11
11
|
def upgrade_scenario
|
@@ -13,12 +13,6 @@ module ForemanMaintain
|
|
13
13
|
maintenance_repo_label: maintenance_repo_label
|
14
14
|
)
|
15
15
|
end
|
16
|
-
|
17
|
-
def upgrade_rescue_scenario
|
18
|
-
Scenarios::SelfUpgradeRescue.new(
|
19
|
-
maintenance_repo_label: maintenance_repo_label
|
20
|
-
)
|
21
|
-
end
|
22
16
|
end
|
23
17
|
end
|
24
18
|
end
|
@@ -99,12 +99,13 @@ module ForemanMaintain
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def packages_action(action, packages, options = {})
|
102
|
-
options.validate_options!(:assumeyes)
|
102
|
+
options.validate_options!(:assumeyes, :yum_options)
|
103
103
|
case action
|
104
104
|
when :install
|
105
105
|
package_manager.install(packages, :assumeyes => options[:assumeyes])
|
106
106
|
when :update
|
107
|
-
package_manager.update(packages, :assumeyes => options[:assumeyes]
|
107
|
+
package_manager.update(packages, :assumeyes => options[:assumeyes],
|
108
|
+
:yum_options => options[:yum_options])
|
108
109
|
when :remove
|
109
110
|
package_manager.remove(packages, :assumeyes => options[:assumeyes])
|
110
111
|
else
|
@@ -53,8 +53,8 @@ module ForemanMaintain::PackageManager
|
|
53
53
|
yum_action('remove', packages, :assumeyes => assumeyes)
|
54
54
|
end
|
55
55
|
|
56
|
-
def update(packages = [], assumeyes: false)
|
57
|
-
yum_action('update', packages, :assumeyes => assumeyes)
|
56
|
+
def update(packages = [], assumeyes: false, yum_options: [])
|
57
|
+
yum_action('update', packages, :assumeyes => assumeyes, :yum_options => yum_options)
|
58
58
|
end
|
59
59
|
|
60
60
|
def clean_cache(assumeyes: false)
|
@@ -114,8 +114,12 @@ module ForemanMaintain::PackageManager
|
|
114
114
|
File.open(protector_config_file, 'w') { |file| file.puts config }
|
115
115
|
end
|
116
116
|
|
117
|
-
|
118
|
-
|
117
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
118
|
+
def yum_action(action, packages, options)
|
119
|
+
with_status = options.fetch(:with_status, false)
|
120
|
+
assumeyes = options.fetch(:assumeyes, false)
|
121
|
+
valid_exit_statuses = options.fetch(:valid_exit_statuses, [0])
|
122
|
+
yum_options = options.fetch(:yum_options, [])
|
119
123
|
packages = [packages].flatten(1)
|
120
124
|
yum_options << '-y' if assumeyes
|
121
125
|
yum_options << '--disableplugin=foreman-protector'
|
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.31
|
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: 2022-
|
11
|
+
date: 2022-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|