foreman_maintain 1.3.3 → 1.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fabde56ed1a12feb739b6776178693bc779dae8ae3d71ba11b5612c09cd3837
4
- data.tar.gz: 24c1ea2e3a56c4a72e444808853d61e0abf56134e071b4d89c4ee501bb6fbedf
3
+ metadata.gz: d90e54ce37bbcb97b38d4362699d2e5fdec4bb6a9c73a6449cebc1c6a20cf970
4
+ data.tar.gz: 79ddf0919edb2fd587d06d414ade8b01994d197f61069dab8bb2d03c22ad72f3
5
5
  SHA512:
6
- metadata.gz: 13fa993d11f4b56cc24d538fd7b9d1b86e39baaad5971266ab8de8a07151d875c6066481b91edadfc5beabd041f4e09b07b298b42ebdc45a1c7c5852d7ac0268
7
- data.tar.gz: 00b68e16dca36bf7c71634a98aa7e4d78846aa5ca5b4cfcbc183dd3b492522c53c02793a215da18048f480a002487e95fe6d9965e5b6c1d382a889fb4dd46598
6
+ metadata.gz: 11c9f890ad98bdac65ca98df002386f6c5435a67b2374e1349d7dc8f53cf79a3587f5ff6f449c0b1f5a7b1a24cb9e96254706c9b2eb9e257679cb1eead8b6831
7
+ data.tar.gz: d827ab0345f35720c3a1eaae0779593b56c6c577f8a72c0aacccc5210cc4d629f8f1a7c2f8afd5371dbdfb042fc2b79414f457d4d69afdbe203d196eb97d60d5
@@ -22,26 +22,12 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
22
22
  @configuration || load_configuration
23
23
  end
24
24
 
25
- def validate_available_in_cpdb?
26
- check_option_using_cpdb_help('validate')
27
- end
28
-
29
25
  def check_option_using_cpdb_help(option_name, parent_cmd = '')
30
26
  parent_cmd = '/usr/share/candlepin/cpdb' if parent_cmd.empty?
31
27
  help_cmd = "#{parent_cmd} --help | grep -c '\\-\\-#{option_name}'"
32
28
  execute?(help_cmd)
33
29
  end
34
30
 
35
- def execute_cpdb_validate_cmd
36
- main_cmd = cpdb_validate_cmd
37
- return [true, nil] if main_cmd.empty?
38
- main_cmd += format_shell_args(
39
- '-u' => configuration['username'], '-p' => configuration[%(password)]
40
- )
41
- main_cmd += format_shell_args(extend_with_db_options)
42
- execute_with_status(main_cmd, :hidden_patterns => [configuration['password']])
43
- end
44
-
45
31
  def env_content_ids_with_null_content
46
32
  sql = <<-SQL
47
33
  SELECT ec.id
@@ -87,12 +73,4 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
87
73
  output = /#{key_name}=([^&]*)?/.match(query_string)
88
74
  output[1] if output
89
75
  end
90
-
91
- def cpdb_validate_cmd
92
- return '' unless check_option_using_cpdb_help('validate')
93
- cmd = '/usr/share/candlepin/cpdb --validate'
94
- return cmd unless check_option_using_cpdb_help('verbose', cmd)
95
- cmd += ' --verbose'
96
- cmd
97
- end
98
76
  end
@@ -28,6 +28,14 @@ class Features::Instance < ForemanMaintain::Feature
28
28
  end
29
29
  end
30
30
 
31
+ def project_support_entity
32
+ if downstream
33
+ 'Red Hat Technical Support'
34
+ else
35
+ 'Foreman Community Support'
36
+ end
37
+ end
38
+
31
39
  def database_remote?(feature)
32
40
  !!feature(feature) && !feature(feature).local?
33
41
  end
@@ -36,7 +36,8 @@ module Procedures::Backup
36
36
  pg_backup_file,
37
37
  :listed_incremental => File.join(@backup_dir, '.postgres.snar'),
38
38
  :volume_size => @tar_volume_size,
39
- :data_dir => pg_data_dir
39
+ :data_dir => pg_data_dir,
40
+ :restore_dir => feature(:candlepin_database).data_dir
40
41
  )
41
42
  end
42
43
  end
@@ -39,11 +39,13 @@ module Procedures::Backup
39
39
  end
40
40
 
41
41
  def do_backup(pg_dir, cmd)
42
+ restore_dir = el? ? feature(:foreman_database).data_dir : pg_dir
42
43
  feature(:foreman_database).backup_local(
43
44
  pg_backup_file,
44
45
  :listed_incremental => File.join(@backup_dir, '.postgres.snar'),
45
46
  :volume_size => @tar_volume_size,
46
47
  :data_dir => pg_dir,
48
+ :restore_dir => restore_dir,
47
49
  :command => cmd
48
50
  )
49
51
  end
@@ -36,7 +36,8 @@ module Procedures::Backup
36
36
  pg_backup_file,
37
37
  :listed_incremental => File.join(@backup_dir, '.postgres.snar'),
38
38
  :volume_size => @tar_volume_size,
39
- :data_dir => pg_data_dir
39
+ :data_dir => pg_data_dir,
40
+ :restore_dir => feature(:pulpcore_database).data_dir
40
41
  )
41
42
  end
42
43
  end
@@ -45,7 +45,9 @@ module ForemanMaintain::Scenarios
45
45
  add_step(Procedures::Service::Stop.new(:only => ['postgresql']))
46
46
  end
47
47
 
48
- if feature(:instance).postgresql_local? && !backup.online_backup?
48
+ if feature(:instance).postgresql_local? &&
49
+ !backup.online_backup? &&
50
+ backup.different_source_os?
49
51
  add_step_with_context(Procedures::Restore::ReindexDatabases)
50
52
  end
51
53
 
@@ -101,13 +101,14 @@ module ForemanMaintain
101
101
 
102
102
  def backup_local(backup_file, extra_tar_options = {})
103
103
  dir = extra_tar_options.fetch(:data_dir, data_dir)
104
+ restore_dir = extra_tar_options.fetch(:restore_dir, data_dir)
104
105
  command = extra_tar_options.fetch(:command, 'create')
105
106
 
106
107
  FileUtils.cd(dir) do
107
108
  tar_options = {
108
109
  :archive => backup_file,
109
110
  :command => command,
110
- :transform => "s,^,#{dir[1..]},S",
111
+ :transform => "s,^,#{restore_dir[1..]},S",
111
112
  :files => '*',
112
113
  }.merge(extra_tar_options)
113
114
  feature(:tar).run(tar_options)
@@ -330,20 +330,20 @@ module ForemanMaintain
330
330
  whitelist_labels = steps_to_whitelist.map(&:label_dashed).join(',')
331
331
  unless whitelist_labels.empty?
332
332
  recommend << if scenario.detector.feature(:instance).downstream
333
- format(<<-MESSAGE.strip_heredoc, whitelist_labels)
333
+ format(<<-MESSAGE.strip_heredoc)
334
334
  Resolve the failed steps and rerun the command.
335
335
 
336
336
  If the situation persists and, you are unclear what to do next,
337
- contact Red Hat Technical Support.
337
+ contact #{scenario.detector.feature(:instance).project_support_entity}.
338
338
 
339
339
  In case the failures are false positives, use
340
- --whitelist="%s"
340
+ --whitelist="#{whitelist_labels}"
341
341
  MESSAGE
342
342
  else
343
- format(<<-MESSAGE.strip_heredoc, whitelist_labels)
343
+ format(<<-MESSAGE.strip_heredoc)
344
344
  Resolve the failed steps and rerun the command.
345
345
  In case the failures are false positives, use
346
- --whitelist="%s"
346
+ --whitelist="#{whitelist_labels}"
347
347
  MESSAGE
348
348
  end
349
349
  end
@@ -265,6 +265,14 @@ module ForemanMaintain
265
265
  def with_qpidd?
266
266
  installed_rpms.any? { |rpm| rpm.start_with?('qpid-cpp-server-') }
267
267
  end
268
+
269
+ def source_os_version
270
+ metadata.fetch('os_version', 'unknown')
271
+ end
272
+
273
+ def different_source_os?
274
+ source_os_version != "#{os_name} #{os_version}"
275
+ end
268
276
  end
269
277
  end
270
278
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.3.3'.freeze
2
+ VERSION = '1.3.5'.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.3.3
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-12 00:00:00.000000000 Z
11
+ date: 2023-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -160,7 +160,6 @@ files:
160
160
  - definitions/checks/backup/certs_tar_exist.rb
161
161
  - definitions/checks/backup/directory_ready.rb
162
162
  - definitions/checks/candlepin/db_up.rb
163
- - definitions/checks/candlepin/validate_db.rb
164
163
  - definitions/checks/check_for_newer_packages.rb
165
164
  - definitions/checks/check_hotfix_installed.rb
166
165
  - definitions/checks/check_tmout.rb
@@ -434,7 +433,7 @@ homepage: https://github.com/theforeman/foreman_maintain
434
433
  licenses:
435
434
  - GPL-3.0
436
435
  metadata: {}
437
- post_install_message:
436
+ post_install_message:
438
437
  rdoc_options: []
439
438
  require_paths:
440
439
  - lib
@@ -452,8 +451,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
452
451
  - !ruby/object:Gem::Version
453
452
  version: '0'
454
453
  requirements: []
455
- rubygems_version: 3.4.10
456
- signing_key:
454
+ rubygems_version: 3.3.26
455
+ signing_key:
457
456
  specification_version: 4
458
457
  summary: Foreman maintenance tool belt
459
458
  test_files: []
@@ -1,17 +0,0 @@
1
- module Checks::Candlepin
2
- class ValidateDb < ForemanMaintain::Check
3
- metadata do
4
- description 'Check to validate candlepin database'
5
- tags :pre_upgrade
6
-
7
- confine do
8
- feature(:candlepin_database)&.validate_available_in_cpdb?
9
- end
10
- end
11
-
12
- def run
13
- result, result_msg = feature(:candlepin_database).execute_cpdb_validate_cmd
14
- assert(result == 0, result_msg)
15
- end
16
- end
17
- end