foreman_maintain 1.6.1 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 548814bfe86ff4c1e83329ac60bbbf5b9502f6cc77c258d82cb7fa5777a00fdf
4
- data.tar.gz: c16c7ee88083f281e69cedbe605990c9e3b54e5e15f3ba4aaa0b3e3b1d5acc10
3
+ metadata.gz: 1b13b3b3d17ba932466b1bee7b2de56dd7a83bb577236d8fba67dcd04674f595
4
+ data.tar.gz: 9f691170e95c2fbefb77db6218216b5d6dc0ec43d33fe4ca20dc84866f6dfd02
5
5
  SHA512:
6
- metadata.gz: e37f22cb90fcd75430b186cb468dc58c7d625c52ec104427119f6e88d1f6d511d98dbedbfff1c9293abd29816156e936d3bb70ada7c21cfb4c1cdca61f2d255e
7
- data.tar.gz: 236e8c299154a4d132506995933f30d8f11ccaf1fdba5756844bc5d9b978d0ce7bd1fa65a2fe5d51abd9e2925e54bf634c083897b1ef14d410e38f4d54ad032e
6
+ metadata.gz: 20e3f6408c0263c62a3bb2b11226f6d87bf6325fd5c14c980e0ca00af7375301e9d342700b400e4c4dca4915a14bac4cc68e006fea17ef5f6fa28120a2890987
7
+ data.tar.gz: 338362b5bbf7c82cd43ec5d20e18c15435a5c122b3d7d4a6c1c6e5cc99e7c795312ead32af13f94fbacd78a877d323396e602df6058b69e4e3256d14cad8f592
@@ -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
@@ -39,18 +39,6 @@ module Scenarios::Capsule_6_16
39
39
  end
40
40
 
41
41
  def compose
42
- add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
43
- if el8?
44
- modules_to_switch = ['postgresql:13']
45
- add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
46
- modules_to_enable = ["satellite-capsule:#{el_short_name}"]
47
- add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
48
- end
49
- add_step(Procedures::Packages::Update.new(
50
- :assumeyes => true,
51
- :dnf_options => ['--downloadonly']
52
- ))
53
-
54
42
  add_steps(find_procedures(:pre_migrations))
55
43
  end
56
44
  end
@@ -66,6 +54,17 @@ module Scenarios::Capsule_6_16
66
54
  end
67
55
 
68
56
  def compose
57
+ add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
58
+ if el8?
59
+ modules_to_switch = ['postgresql:13']
60
+ add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
61
+ modules_to_enable = ["satellite-capsule:#{el_short_name}"]
62
+ add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
63
+ end
64
+ add_step(Procedures::Packages::Update.new(
65
+ :assumeyes => true,
66
+ :dnf_options => ['--downloadonly']
67
+ ))
69
68
  add_step(Procedures::Service::Stop.new)
70
69
  add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
71
70
  add_step_with_context(Procedures::Installer::Run)
@@ -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
 
@@ -39,17 +40,6 @@ module Scenarios::Satellite_6_16
39
40
  end
40
41
 
41
42
  def compose
42
- add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
43
- if el8?
44
- modules_to_switch = ['postgresql:13']
45
- add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
46
- modules_to_enable = ["satellite:#{el_short_name}"]
47
- add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
48
- end
49
- add_step(Procedures::Packages::Update.new(
50
- :assumeyes => true,
51
- :dnf_options => ['--downloadonly']
52
- ))
53
43
  add_steps(find_procedures(:pre_migrations))
54
44
  end
55
45
  end
@@ -66,6 +56,17 @@ module Scenarios::Satellite_6_16
66
56
  end
67
57
 
68
58
  def compose
59
+ add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
60
+ if el8?
61
+ modules_to_switch = ['postgresql:13']
62
+ add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
63
+ modules_to_enable = ["satellite:#{el_short_name}"]
64
+ add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
65
+ end
66
+ add_step(Procedures::Packages::Update.new(
67
+ :assumeyes => true,
68
+ :dnf_options => ['--downloadonly']
69
+ ))
69
70
  add_step(Procedures::Service::Stop.new)
70
71
  add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
71
72
  add_step_with_context(Procedures::Installer::Run)
@@ -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, `hostname -f`.chomp)
24
+ @foreman_url = @options.fetch(:foreman_url) { `hostname -f`.chomp }
25
25
  @foreman_port = @options.fetch(:foreman_port, 443)
26
26
  end
27
27
 
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.6.1'.freeze
2
+ VERSION = '1.6.3'.freeze
3
3
  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.1
4
+ version: 1.6.3
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-03-18 00:00:00.000000000 Z
11
+ date: 2024-04-09 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