foreman_maintain 1.6.2 → 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: bffec6895a006066de751609395b0f865e1dee34b90d01111d2792af59a6b893
4
- data.tar.gz: 9388cc01c5be3b68685e7947676119c5fd648a02c0e73bdafb8f8752f7390c45
3
+ metadata.gz: 1b13b3b3d17ba932466b1bee7b2de56dd7a83bb577236d8fba67dcd04674f595
4
+ data.tar.gz: 9f691170e95c2fbefb77db6218216b5d6dc0ec43d33fe4ca20dc84866f6dfd02
5
5
  SHA512:
6
- metadata.gz: dcdee36a3f44d9809a65b7105f073ed79c10e60d16d34eb4300c1e4ebb4b32255d297b8d9c3eeca346d6865dd88f0c4a5dd66b297dbcea81f8b6d6c0a42ea039
7
- data.tar.gz: 90be6369c664ca1fc46b81040a43599b02ba7c2fd26aed1ce628680d750147a3d982593d7cb8694fa3ea6935440ed8eec5bbcd1d78ce98dd79f5a8e8b7b347ac
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
@@ -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
 
@@ -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.2'.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.2
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-29 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