foreman_maintain 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -20
  3. data/definitions/checks/disk/available_space_candlepin.rb +1 -1
  4. data/definitions/checks/disk/available_space_postgresql13.rb +42 -0
  5. data/definitions/checks/foreman/check_corrupted_roles.rb +0 -3
  6. data/definitions/checks/foreman/validate_external_db_version.rb +1 -2
  7. data/definitions/features/foreman_proxy.rb +1 -5
  8. data/definitions/features/foreman_tasks.rb +2 -6
  9. data/definitions/features/installer.rb +0 -4
  10. data/definitions/features/pulpcore_database.rb +1 -1
  11. data/definitions/procedures/backup/offline/candlepin_db.rb +1 -6
  12. data/definitions/procedures/backup/offline/foreman_db.rb +1 -8
  13. data/definitions/procedures/backup/offline/pulpcore_db.rb +1 -6
  14. data/definitions/procedures/backup/pulp.rb +1 -10
  15. data/definitions/procedures/foreman/fix_corrupted_roles.rb +0 -3
  16. data/definitions/procedures/puppet/remove_puppet.rb +1 -2
  17. data/definitions/procedures/restore/installer_reset.rb +1 -17
  18. data/definitions/scenarios/backup.rb +5 -88
  19. data/definitions/scenarios/packages.rb +2 -2
  20. data/definitions/scenarios/puppet.rb +4 -6
  21. data/definitions/scenarios/restore.rb +1 -1
  22. data/definitions/scenarios/upgrade_to_capsule_6_16.rb +7 -4
  23. data/definitions/scenarios/upgrade_to_capsule_6_16_z.rb +6 -4
  24. data/definitions/scenarios/upgrade_to_foreman_nightly.rb +3 -3
  25. data/definitions/scenarios/upgrade_to_katello_nightly.rb +6 -4
  26. data/definitions/scenarios/upgrade_to_satellite_6_16.rb +7 -4
  27. data/definitions/scenarios/upgrade_to_satellite_6_16_z.rb +6 -4
  28. data/lib/foreman_maintain/cli/backup_command.rb +0 -27
  29. data/lib/foreman_maintain/cli.rb +2 -0
  30. data/lib/foreman_maintain/concerns/base_database.rb +0 -4
  31. data/lib/foreman_maintain/concerns/downstream.rb +0 -4
  32. data/lib/foreman_maintain/concerns/os_facts.rb +4 -0
  33. data/lib/foreman_maintain/concerns/system_helpers.rb +0 -12
  34. data/lib/foreman_maintain/version.rb +1 -1
  35. data/lib/foreman_maintain.rb +1 -1
  36. metadata +3 -15
  37. data/definitions/checks/disk/available_space_postgresql12.rb +0 -46
  38. data/definitions/procedures/backup/snapshot/clean_mount.rb +0 -24
  39. data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +0 -56
  40. data/definitions/procedures/backup/snapshot/mount_base.rb +0 -27
  41. data/definitions/procedures/backup/snapshot/mount_candlepin_db.rb +0 -48
  42. data/definitions/procedures/backup/snapshot/mount_foreman_db.rb +0 -48
  43. data/definitions/procedures/backup/snapshot/mount_pulp.rb +0 -32
  44. data/definitions/procedures/backup/snapshot/mount_pulpcore_db.rb +0 -48
  45. data/definitions/procedures/backup/snapshot/prepare_mount.rb +0 -16
  46. data/definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb +0 -14
  47. data/definitions/procedures/foreman/remove_duplicate_obsolete_roles.rb +0 -64
  48. data/definitions/procedures/installer/run_for_6_11.rb +0 -52
  49. data/definitions/procedures/installer/upgrade.rb +0 -12
@@ -1,64 +0,0 @@
1
- module Procedures::Foreman
2
- class RemoveDuplicateObsoleteRoles < ForemanMaintain::Procedure
3
- metadata do
4
- for_feature :foreman_database
5
- description 'Remove duplicate obsolete roles from DB'
6
- confine do
7
- check_max_version('foreman', '1.20')
8
- end
9
- end
10
-
11
- def run
12
- duplicate_roles = feature(:foreman_database).query(
13
- Checks::Foreman::CheckDuplicateRoles.query_to_get_duplicate_roles
14
- )
15
- roles_hash = duplicate_roles.each_with_object({}) do |role_rec, new_obj|
16
- r_name = role_rec['name']
17
- new_obj[r_name] = [] unless new_obj.key?(r_name)
18
- new_obj[r_name] << role_rec['id'].to_i
19
- end
20
- duplicate_role_ids = filter_consumed_roles(roles_hash)
21
- remove_obsolete_role_records(duplicate_role_ids) unless duplicate_role_ids.empty?
22
- end
23
-
24
- private
25
-
26
- def filter_consumed_roles(roles_hash)
27
- consumed_role_ids = find_consumed_role_ids
28
- roles_hash.values.map do |ids|
29
- consumed_ids = ids & consumed_role_ids
30
- if consumed_ids.count == 1
31
- ids -= consumed_ids
32
- elsif consumed_ids.count > 1
33
- ids -= consumed_ids
34
- update_duplicate_consumed_roles(consumed_ids)
35
- elsif ids.length > 1
36
- ids.delete(ids.min)
37
- end
38
- ids
39
- end.flatten
40
- end
41
-
42
- def find_consumed_role_ids
43
- feature(:foreman_database).query(<<-SQL).map { |r| r['role_id'].to_i }
44
- select DISTINCT(role_id) role_id from user_roles
45
- SQL
46
- end
47
-
48
- def update_duplicate_consumed_roles(role_ids)
49
- logger.info("Updating name of duplicate consumed roles using id(s): #{role_ids.join(', ')}")
50
-
51
- feature(:foreman_database).psql(<<-SQL)
52
- UPDATE roles set name = concat(name, ' - ', id) where id in (#{role_ids.join(', ')})
53
- SQL
54
- end
55
-
56
- def remove_obsolete_role_records(role_ids)
57
- feature(:foreman_database).psql(<<-SQL)
58
- BEGIN;
59
- DELETE from roles r where r.id IN (#{role_ids.join(', ')});
60
- COMMIT;
61
- SQL
62
- end
63
- end
64
- end
@@ -1,52 +0,0 @@
1
- module Procedures::Installer
2
- class RunFor6_11 < ForemanMaintain::Procedure
3
- metadata do
4
- description 'Run installer with Candlepin SSL CA'\
5
- ' when using external database with SSL'
6
- param :assumeyes, 'Do not ask for confirmation'
7
- manual_detection
8
- end
9
-
10
- def run
11
- if extdb_and_ssl?
12
- run_installer_with_extra_option
13
- else
14
- run_installer
15
- end
16
- end
17
-
18
- def ext_db?
19
- !feature(:foreman_database).local?
20
- end
21
-
22
- def installer_answers
23
- @installer_answers ||= feature(:installer).answers
24
- end
25
-
26
- def server_db_with_ssl?
27
- installer_answers.fetch('katello')['candlepin_db_ssl']
28
- end
29
-
30
- def extdb_and_ssl?
31
- ext_db? && server_db_with_ssl?
32
- end
33
-
34
- def run_installer_with_extra_option
35
- ssl_ca_path = installer_answers.fetch('foreman')['db_root_cert']
36
- spinner_msg = "Running installer with --katello-candlepin-db-ssl-ca #{ssl_ca_path} argument!"
37
- with_spinner(spinner_msg) do
38
- installer_args = feature(:installer).installer_arguments
39
- new_ssl_arg = " --katello-candlepin-db-ssl-ca #{ssl_ca_path}"
40
- installer_args << new_ssl_arg
41
- feature(:installer).run(installer_args)
42
- end
43
- end
44
-
45
- def run_installer
46
- with_spinner('Executing installer') do
47
- assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
48
- feature(:installer).upgrade(:interactive => !assumeyes_val)
49
- end
50
- end
51
- end
52
- end
@@ -1,12 +0,0 @@
1
- module Procedures::Installer
2
- class Upgrade < ForemanMaintain::Procedure
3
- metadata do
4
- param :assumeyes, 'Do not ask for confirmation'
5
- end
6
-
7
- def run
8
- assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
9
- feature(:installer).upgrade(:interactive => !assumeyes_val)
10
- end
11
- end
12
- end