foreman_maintain 1.6.2 → 1.6.4
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/sca_only.rb +56 -0
- data/definitions/procedures/packages/update_all_confirmation.rb +1 -2
- data/definitions/scenarios/packages.rb +29 -7
- data/definitions/scenarios/upgrade_to_satellite_6_16.rb +1 -0
- data/extras/foreman_protector/dnf/foreman-protector.py +5 -1
- data/lib/foreman_maintain/cli/packages_command.rb +4 -1
- data/lib/foreman_maintain/cli.rb +0 -7
- data/lib/foreman_maintain/config.rb +1 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc4310d22dcb14b51945e3642cba4c7050e6660893dc09639064b013a2881380
|
|
4
|
+
data.tar.gz: d305fc1da3bd0a013d4455ec1ae578f22529fe5302261f82be251be5a0ee9a84
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d10f290659e20460fffcebf72291e7260a6caf3c8d0964bdb3bd40d9f86ec9b8a5f70781c2f9de2d01778f09bdcda1421defb679a7f541d7ff4b21406368ca3c
|
|
7
|
+
data.tar.gz: c63898eece400b9d3813e06e070a3188c27ad5a06aaf57652c68e6f0887bf5b9173b6dd6eb9192acf37dff6b8d2b4c89285f65cf427de72a7a1aa69cc4b9f703
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
class Checks::CheckOrganizationContentAccessMode < ForemanMaintain::Check
|
|
2
|
+
metadata do
|
|
3
|
+
label :check_organization_content_access_mode
|
|
4
|
+
description 'Check if any organizations are using entitlement mode'
|
|
5
|
+
|
|
6
|
+
confine do
|
|
7
|
+
feature(:katello)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
doc_link = "https://access.redhat.com/articles/simple-content-access"
|
|
13
|
+
|
|
14
|
+
with_spinner('Checking organization content access modes') do
|
|
15
|
+
output = execute_org_check
|
|
16
|
+
orgs_to_migrate = parse_orgs_to_migrate(output)
|
|
17
|
+
|
|
18
|
+
assert(
|
|
19
|
+
orgs_to_migrate.empty?,
|
|
20
|
+
"\nThe following organizations are using entitlement mode:\n"\
|
|
21
|
+
"#{format_orgs_to_migrate(orgs_to_migrate)}\n\n"\
|
|
22
|
+
"As of Satellite 6.16, entitlement mode is removed, and these organizations"\
|
|
23
|
+
" will be automatically migrated to Simple Content Access during the upgrade."\
|
|
24
|
+
" Please ensure that you have reviewed the documentation and are prepared for this change."\
|
|
25
|
+
" Documentation for SCA mode is available at #{doc_link}"
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
# rubocop:disable Lint/InterpolationCheck
|
|
33
|
+
def execute_org_check
|
|
34
|
+
execute!(
|
|
35
|
+
'echo "Organization.all.each ' \
|
|
36
|
+
'{ |org| puts \"NONSCA: #{org.name}\" unless org.simple_content_access? }" ' \
|
|
37
|
+
'| foreman-rake console'
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
# rubocop:enable Lint/InterpolationCheck
|
|
41
|
+
|
|
42
|
+
def parse_orgs_to_migrate(output)
|
|
43
|
+
orgs = []
|
|
44
|
+
output.each_line do |line|
|
|
45
|
+
match = line.match(/NONSCA: (.+)/)
|
|
46
|
+
if match && !match[1].strip.start_with?('#{org.name}') # rubocop:disable Lint/InterpolationCheck
|
|
47
|
+
orgs << match[1].strip
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
orgs
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def format_orgs_to_migrate(orgs_to_migrate)
|
|
54
|
+
orgs_to_migrate.join("\n")
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -13,10 +13,9 @@ module Procedures::Packages
|
|
|
13
13
|
"It is recommended to update everything only as part of upgrade\n" \
|
|
14
14
|
"of the #{feature(:instance).product_name} to the next version. \n" \
|
|
15
15
|
"To Upgrade to next version use 'foreman-maintain upgrade'.\n\n" \
|
|
16
|
-
"NOTE: --assumeyes is not applicable for this check\n\n" \
|
|
17
16
|
"Do you want to proceed with update of everything regardless\n" \
|
|
18
17
|
'of the recommendations?'
|
|
19
|
-
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)'
|
|
18
|
+
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
|
|
20
19
|
abort! unless answer == :yes
|
|
21
20
|
end
|
|
22
21
|
end
|
|
@@ -97,25 +97,47 @@ module ForemanMaintain::Scenarios
|
|
|
97
97
|
description 'update packages in unlocked session'
|
|
98
98
|
param :packages, 'List of packages to Update', :array => true
|
|
99
99
|
param :assumeyes, 'Do not ask for confirmation'
|
|
100
|
+
param :downloadonly, 'Download and cache packages'
|
|
100
101
|
manual_detection
|
|
101
102
|
end
|
|
102
103
|
|
|
104
|
+
# rubocop:disable Metrics/MethodLength
|
|
103
105
|
def compose
|
|
104
106
|
if Packages.skip_installer_run?(context.get(:packages))
|
|
105
107
|
add_step_with_context(Procedures::Packages::Update,
|
|
106
108
|
:force => true, :warn_on_errors => true)
|
|
107
109
|
else
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
unless context.get(:downloadonly)
|
|
111
|
+
add_steps_with_context(
|
|
112
|
+
Procedures::Packages::UpdateAllConfirmation,
|
|
113
|
+
Procedures::Packages::InstallerConfirmation
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
|
|
112
117
|
add_step_with_context(Procedures::Packages::UnlockVersions)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
|
|
119
|
+
if context.get(:downloadonly)
|
|
120
|
+
add_step_with_context(
|
|
121
|
+
Procedures::Packages::Update,
|
|
122
|
+
:force => true,
|
|
123
|
+
:warn_on_errors => true,
|
|
124
|
+
:dnf_options => ['--downloadonly']
|
|
125
|
+
)
|
|
126
|
+
add_step_with_context(Procedures::Packages::LockVersions)
|
|
127
|
+
else
|
|
128
|
+
add_step_with_context(
|
|
129
|
+
Procedures::Packages::Update,
|
|
130
|
+
:force => true,
|
|
131
|
+
:warn_on_errors => true
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
add_step_with_context(Procedures::Installer::Run)
|
|
135
|
+
end
|
|
136
|
+
|
|
116
137
|
add_step(Procedures::Packages::LockingStatus)
|
|
117
138
|
end
|
|
118
139
|
end
|
|
140
|
+
# rubocop:enable Metrics/MethodLength
|
|
119
141
|
|
|
120
142
|
def set_context_mapping
|
|
121
143
|
context.map(:packages,
|
|
@@ -29,6 +29,7 @@ module Scenarios::Satellite_6_16
|
|
|
29
29
|
add_steps(find_checks(:pre_upgrade))
|
|
30
30
|
add_step(Checks::Disk::AvailableSpacePostgresql13)
|
|
31
31
|
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
|
|
32
|
+
add_step(Checks::CheckOrganizationContentAccessMode)
|
|
32
33
|
end
|
|
33
34
|
end
|
|
34
35
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import configparser
|
|
2
|
+
import os
|
|
3
|
+
|
|
1
4
|
import dnf
|
|
2
5
|
import dnf.exceptions
|
|
3
6
|
from dnfpluginscore import _, logger
|
|
4
7
|
|
|
5
|
-
import configparser
|
|
6
8
|
|
|
7
9
|
PROTECT_COMMANDS = ('install', 'downgrade', 'reinstall', 'distro-sync', 'swap', 'upgrade', 'upgrade-minimal')
|
|
8
10
|
|
|
@@ -53,6 +55,8 @@ class ForemanProtector(dnf.Plugin):
|
|
|
53
55
|
def sack(self):
|
|
54
56
|
if self.cli is not None and self.cli.command._basecmd not in PROTECT_COMMANDS:
|
|
55
57
|
return
|
|
58
|
+
if os.environ.get('LEAPP_IPU_IN_PROGRESS') is not None:
|
|
59
|
+
return
|
|
56
60
|
whitelist_and_obsoletes = self._add_obsoletes()
|
|
57
61
|
all_available_packages = self.base.sack.query().available()
|
|
58
62
|
excluded_pkgs_query = all_available_packages.difference(whitelist_and_obsoletes)
|
|
@@ -55,12 +55,15 @@ module ForemanMaintain
|
|
|
55
55
|
subcommand 'update', 'Update packages in an unlocked session' do
|
|
56
56
|
interactive_option(['assumeyes'])
|
|
57
57
|
parameter '[PACKAGES] ...', 'packages to update', :attribute_name => :packages
|
|
58
|
+
option '--downloadonly', :flag, 'Downloads and caches package updates only',
|
|
59
|
+
:default => false
|
|
58
60
|
|
|
59
61
|
def execute
|
|
60
62
|
run_scenarios_and_exit(
|
|
61
63
|
Scenarios::Packages::Update.new(
|
|
62
64
|
:packages => packages,
|
|
63
|
-
:assumeyes => assumeyes
|
|
65
|
+
:assumeyes => assumeyes?,
|
|
66
|
+
:downloadonly => @downloadonly
|
|
64
67
|
)
|
|
65
68
|
)
|
|
66
69
|
end
|
data/lib/foreman_maintain/cli.rb
CHANGED
|
@@ -44,16 +44,10 @@ module ForemanMaintain
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
return @exit_code
|
|
47
|
-
ensure
|
|
48
|
-
log_exit_code_info(@exit_code)
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
private
|
|
52
50
|
|
|
53
|
-
def log_exit_code_info(exit_code)
|
|
54
|
-
logger.info("foreman-maintain command finished with #{exit_code}")
|
|
55
|
-
end
|
|
56
|
-
|
|
57
51
|
def process_standard_error(error)
|
|
58
52
|
if error.is_a?(Clamp::HelpWanted) ||
|
|
59
53
|
error.is_a?(ArgumentError) ||
|
|
@@ -68,7 +62,6 @@ module ForemanMaintain
|
|
|
68
62
|
end
|
|
69
63
|
|
|
70
64
|
def process_usage_error(error)
|
|
71
|
-
log_exit_code_info(1)
|
|
72
65
|
$stderr.puts error.message
|
|
73
66
|
exit!
|
|
74
67
|
end
|
|
@@ -21,7 +21,7 @@ module ForemanMaintain
|
|
|
21
21
|
@options.fetch(:completion_cache_file, '~/.cache/foreman_maintain_completion.yml')
|
|
22
22
|
)
|
|
23
23
|
@disable_commands = @options.fetch(:disable_commands, [])
|
|
24
|
-
@foreman_url = @options.fetch(:foreman_url
|
|
24
|
+
@foreman_url = @options.fetch(:foreman_url) { `hostname -f`.chomp }
|
|
25
25
|
@foreman_port = @options.fetch(:foreman_port, 443)
|
|
26
26
|
end
|
|
27
27
|
|
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.4
|
|
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-
|
|
11
|
+
date: 2024-04-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: clamp
|
|
@@ -194,6 +194,7 @@ files:
|
|
|
194
194
|
- definitions/checks/restore/validate_interfaces.rb
|
|
195
195
|
- definitions/checks/restore/validate_postgresql_dump_permissions.rb
|
|
196
196
|
- definitions/checks/root_user.rb
|
|
197
|
+
- definitions/checks/sca_only.rb
|
|
197
198
|
- definitions/checks/server_ping.rb
|
|
198
199
|
- definitions/checks/services_up.rb
|
|
199
200
|
- definitions/checks/system_registration.rb
|