foreman_maintain 0.6.15 → 0.7.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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/definitions/checks/disk/available_space_candlepin.rb +27 -0
  4. data/definitions/checks/foreman_tasks/not_paused.rb +10 -13
  5. data/definitions/checks/package_manager/yum/validate_yum_config.rb +51 -0
  6. data/definitions/features/candlepin.rb +4 -0
  7. data/definitions/features/foreman_cockpit.rb +15 -0
  8. data/definitions/features/foreman_tasks.rb +12 -2
  9. data/definitions/features/pulpcore.rb +20 -5
  10. data/definitions/procedures/backup/accessibility_confirmation.rb +1 -1
  11. data/definitions/procedures/backup/online/safety_confirmation.rb +11 -6
  12. data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +1 -1
  13. data/definitions/procedures/content/migration_stats.rb +12 -0
  14. data/definitions/procedures/content/prepare.rb +2 -6
  15. data/definitions/procedures/content/prepare_abort.rb +12 -0
  16. data/definitions/procedures/content/switchover.rb +1 -1
  17. data/definitions/procedures/foreman_tasks/delete.rb +3 -4
  18. data/definitions/procedures/foreman_tasks/resume.rb +5 -0
  19. data/definitions/procedures/packages/installer_confirmation.rb +1 -1
  20. data/definitions/procedures/packages/update_all_confirmation.rb +1 -1
  21. data/definitions/procedures/prep_6_10_upgrade.rb +29 -0
  22. data/definitions/procedures/restore/confirmation.rb +1 -1
  23. data/definitions/procedures/restore/installer_reset.rb +10 -1
  24. data/definitions/scenarios/backup.rb +2 -0
  25. data/definitions/scenarios/content.rb +52 -3
  26. data/definitions/scenarios/prep_6_10_upgrade.rb +13 -0
  27. data/definitions/scenarios/upgrade_to_capsule_6_9.rb +88 -0
  28. data/definitions/scenarios/upgrade_to_capsule_6_9_z.rb +88 -0
  29. data/definitions/scenarios/upgrade_to_satellite_6_9.rb +90 -0
  30. data/definitions/scenarios/upgrade_to_satellite_6_9_z.rb +89 -0
  31. data/lib/foreman_maintain.rb +1 -1
  32. data/lib/foreman_maintain/cli.rb +8 -0
  33. data/lib/foreman_maintain/cli/content_command.rb +17 -2
  34. data/lib/foreman_maintain/concerns/downstream.rb +4 -0
  35. data/lib/foreman_maintain/package_manager/dnf.rb +1 -0
  36. data/lib/foreman_maintain/reporter.rb +18 -13
  37. data/lib/foreman_maintain/reporter/cli_reporter.rb +24 -11
  38. data/lib/foreman_maintain/runner.rb +13 -8
  39. data/lib/foreman_maintain/scenario.rb +4 -0
  40. data/lib/foreman_maintain/utils/backup.rb +1 -1
  41. data/lib/foreman_maintain/utils/disk/io_device.rb +4 -0
  42. data/lib/foreman_maintain/utils/service/systemd.rb +11 -1
  43. data/lib/foreman_maintain/version.rb +1 -1
  44. metadata +14 -4
  45. data/definitions/checks/yum_exclude.rb +0 -21
@@ -10,7 +10,7 @@ module Procedures::Restore
10
10
  "Your existing installation will be replaced with the backup database.\n" \
11
11
  "Once this operation is complete there is no going back.\n" \
12
12
  'Do you want to proceed?'
13
- answer = ask_decision(warning, 'y(yes), q(quit)')
13
+ answer = ask_decision(warning, actions_msg: 'y(yes), q(quit)')
14
14
  abort! unless answer == :yes
15
15
  end
16
16
  end
@@ -12,7 +12,7 @@ module Procedures::Restore
12
12
 
13
13
  def installer_cmd
14
14
  installer = "yes | #{feature(:installer).installer_command} "
15
- installer << '-v --reset '
15
+ installer << reset_option
16
16
  if feature(:instance).foreman_proxy_with_content?
17
17
  installer << '--foreman-proxy-register-in-foreman false '
18
18
  end
@@ -27,5 +27,14 @@ module Procedures::Restore
27
27
  end
28
28
  installer
29
29
  end
30
+
31
+ def reset_option
32
+ if check_min_version('foreman', '2.2') || \
33
+ check_min_version('foreman-proxy', '2.2')
34
+ return '-v --reset-data '
35
+ end
36
+
37
+ '-v --reset '
38
+ end
30
39
  end
31
40
  end
@@ -94,6 +94,8 @@ module ForemanMaintain::Scenarios
94
94
  Procedures::Backup::Snapshot::MountPulp => :skip)
95
95
  context.map(:tar_volume_size,
96
96
  Procedures::Backup::Pulp => :tar_volume_size)
97
+ context.map(:include_db_dumps,
98
+ Procedures::Backup::Online::SafetyConfirmation => :include_db_dumps)
97
99
  end
98
100
  # rubocop:enable Metrics/MethodLength
99
101
 
@@ -8,11 +8,31 @@ module ForemanMaintain::Scenarios
8
8
  end
9
9
 
10
10
  def compose
11
- # FIXME: remove this condition on next downstream upgrade scenario
12
- if Procedures::Content::Prepare.present?
11
+ if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
12
+ enable_and_start_services
13
+ add_step(Procedures::Content::Prepare)
14
+ disable_and_stop_services
15
+ elsif !feature(:satellite)
13
16
  add_step(Procedures::Content::Prepare)
14
17
  end
15
18
  end
19
+
20
+ private
21
+
22
+ def enable_and_start_services
23
+ add_step(Procedures::Service::Start)
24
+ add_step(Procedures::Service::Enable.
25
+ new(:only => Features::Pulpcore.pulpcore_migration_services))
26
+ add_step(Procedures::Service::Start.
27
+ new(:only => Features::Pulpcore.pulpcore_migration_services))
28
+ end
29
+
30
+ def disable_and_stop_services
31
+ add_step(Procedures::Service::Stop.
32
+ new(:only => Features::Pulpcore.pulpcore_migration_services))
33
+ add_step(Procedures::Service::Disable.
34
+ new(:only => Features::Pulpcore.pulpcore_migration_services))
35
+ end
16
36
  end
17
37
 
18
38
  class Switchover < ForemanMaintain::Scenario
@@ -23,9 +43,38 @@ module ForemanMaintain::Scenarios
23
43
  end
24
44
 
25
45
  def compose
26
- # FIXME: remove this condition on next downstream upgrade scenario
46
+ # FIXME: remove this condition for the 6.10 upgrade scenario
27
47
  if Procedures::Content::Switchover.present?
28
48
  add_step(Procedures::Content::Switchover)
49
+ add_step(Procedures::Foreman::ApipieCache)
50
+ end
51
+ end
52
+ end
53
+
54
+ class PrepareAbort < ForemanMaintain::Scenario
55
+ metadata do
56
+ label :content_prepare_abort
57
+ description 'Abort all running Pulp 2 to Pulp 3 migration tasks'
58
+ manual_detection
59
+ end
60
+
61
+ def compose
62
+ if !feature(:satellite) || feature(:satellite).at_least_version?('6.9')
63
+ add_step(Procedures::Content::PrepareAbort)
64
+ end
65
+ end
66
+ end
67
+
68
+ class MigrationStats < ForemanMaintain::Scenario
69
+ metadata do
70
+ label :content_migration_stats
71
+ description 'Retrieve Pulp 2 to Pulp 3 migration statistics'
72
+ manual_detection
73
+ end
74
+
75
+ def compose
76
+ if !feature(:satellite) || feature(:satellite).at_least_version?('6.9')
77
+ add_step(Procedures::Content::MigrationStats)
29
78
  end
30
79
  end
31
80
  end
@@ -0,0 +1,13 @@
1
+ module ForemanMaintain::Scenarios
2
+ class Prep610Upgrade < ForemanMaintain::Scenario
3
+ metadata do
4
+ label :prep_6_10_upgrade
5
+ description 'Preparations for the Satellite 6.10 upgrade'
6
+ manual_detection
7
+ end
8
+
9
+ def compose
10
+ add_step(Procedures::Prep610Upgrade)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,88 @@
1
+ module Scenarios::Capsule_6_9
2
+ class Abstract < ForemanMaintain::Scenario
3
+ def self.upgrade_metadata(&block)
4
+ metadata do
5
+ tags :upgrade_scenario
6
+ confine do
7
+ feature(:capsule) &&
8
+ (feature(:capsule).current_minor_version == '6.8' || \
9
+ ForemanMaintain.upgrade_in_progress == '6.9')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '6.9'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Capsule 6.9'
23
+ tags :pre_upgrade_checks
24
+ run_strategy :fail_slow
25
+ end
26
+
27
+ def compose
28
+ add_steps(find_checks(:default))
29
+ add_steps(find_checks(:pre_upgrade))
30
+ add_step(Checks::Repositories::Validate.new(:version => '6.9'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Capsule 6.9'
37
+ tags :pre_migrations
38
+ end
39
+
40
+ def compose
41
+ add_steps(find_procedures(:pre_migrations))
42
+ add_step(Procedures::Service::Stop.new)
43
+ end
44
+ end
45
+
46
+ class Migrations < Abstract
47
+ upgrade_metadata do
48
+ description 'Migration scripts to Capsule 6.9'
49
+ tags :migrations
50
+ end
51
+
52
+ def set_context_mapping
53
+ context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
54
+ end
55
+
56
+ def compose
57
+ add_step(Procedures::Repositories::Setup.new(:version => '6.9'))
58
+ add_step(Procedures::Packages::UnlockVersions.new)
59
+ add_step(Procedures::Packages::Update.new(:assumeyes => true))
60
+ add_step_with_context(Procedures::Installer::Upgrade)
61
+ end
62
+ end
63
+
64
+ class PostMigrations < Abstract
65
+ upgrade_metadata do
66
+ description 'Procedures after migrating to Capsule 6.9'
67
+ tags :post_migrations
68
+ end
69
+
70
+ def compose
71
+ add_step(Procedures::Service::Start.new)
72
+ add_steps(find_procedures(:post_migrations))
73
+ end
74
+ end
75
+
76
+ class PostUpgradeChecks < Abstract
77
+ upgrade_metadata do
78
+ description 'Checks after upgrading to Capsule 6.9'
79
+ tags :post_upgrade_checks
80
+ run_strategy :fail_slow
81
+ end
82
+
83
+ def compose
84
+ add_steps(find_checks(:default))
85
+ add_steps(find_checks(:post_upgrade))
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,88 @@
1
+ module Scenarios::Capsule_6_9_z
2
+ class Abstract < ForemanMaintain::Scenario
3
+ def self.upgrade_metadata(&block)
4
+ metadata do
5
+ tags :upgrade_scenario
6
+ confine do
7
+ feature(:capsule) &&
8
+ (feature(:capsule).current_minor_version == '6.9' || \
9
+ ForemanMaintain.upgrade_in_progress == '6.9.z')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '6.9.z'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Capsule 6.9.z'
23
+ tags :pre_upgrade_checks
24
+ run_strategy :fail_slow
25
+ end
26
+
27
+ def compose
28
+ add_steps(find_checks(:default))
29
+ add_steps(find_checks(:pre_upgrade))
30
+ add_step(Checks::Repositories::Validate.new(:version => '6.9'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Capsule 6.9.z'
37
+ tags :pre_migrations
38
+ end
39
+
40
+ def compose
41
+ add_steps(find_procedures(:pre_migrations))
42
+ add_step(Procedures::Service::Stop.new)
43
+ end
44
+ end
45
+
46
+ class Migrations < Abstract
47
+ upgrade_metadata do
48
+ description 'Migration scripts to Capsule 6.9.z'
49
+ tags :migrations
50
+ end
51
+
52
+ def set_context_mapping
53
+ context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
54
+ end
55
+
56
+ def compose
57
+ add_step(Procedures::Repositories::Setup.new(:version => '6.9'))
58
+ add_step(Procedures::Packages::UnlockVersions.new)
59
+ add_step(Procedures::Packages::Update.new(:assumeyes => true))
60
+ add_step_with_context(Procedures::Installer::Upgrade)
61
+ end
62
+ end
63
+
64
+ class PostMigrations < Abstract
65
+ upgrade_metadata do
66
+ description 'Procedures after migrating to Capsule 6.9.z'
67
+ tags :post_migrations
68
+ end
69
+
70
+ def compose
71
+ add_step(Procedures::Service::Start.new)
72
+ add_steps(find_procedures(:post_migrations))
73
+ end
74
+ end
75
+
76
+ class PostUpgradeChecks < Abstract
77
+ upgrade_metadata do
78
+ description 'Checks after upgrading to Capsule 6.9.z'
79
+ tags :post_upgrade_checks
80
+ run_strategy :fail_slow
81
+ end
82
+
83
+ def compose
84
+ add_steps(find_checks(:default))
85
+ add_steps(find_checks(:post_upgrade))
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,90 @@
1
+ module Scenarios::Satellite_6_9
2
+ class Abstract < ForemanMaintain::Scenario
3
+ def self.upgrade_metadata(&block)
4
+ metadata do
5
+ tags :upgrade_scenario
6
+ confine do
7
+ feature(:satellite) &&
8
+ (feature(:satellite).current_minor_version == '6.8' || \
9
+ ForemanMaintain.upgrade_in_progress == '6.9')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '6.9'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Satellite 6.9'
23
+ tags :pre_upgrade_checks
24
+ run_strategy :fail_slow
25
+ end
26
+
27
+ def compose
28
+ add_steps(find_checks(:default))
29
+ add_steps(find_checks(:pre_upgrade))
30
+ add_step(Checks::Foreman::CheckpointSegments)
31
+ add_step(Checks::Repositories::Validate.new(:version => '6.9'))
32
+ end
33
+ end
34
+
35
+ class PreMigrations < Abstract
36
+ upgrade_metadata do
37
+ description 'Procedures before migrating to Satellite 6.9'
38
+ tags :pre_migrations
39
+ end
40
+
41
+ def compose
42
+ add_steps(find_procedures(:pre_migrations))
43
+ add_step(Procedures::Service::Stop.new)
44
+ end
45
+ end
46
+
47
+ class Migrations < Abstract
48
+ upgrade_metadata do
49
+ description 'Migration scripts to Satellite 6.9'
50
+ tags :migrations
51
+ end
52
+
53
+ def set_context_mapping
54
+ context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
55
+ end
56
+
57
+ def compose
58
+ add_step(Procedures::Repositories::Setup.new(:version => '6.9'))
59
+ add_step(Procedures::Packages::UnlockVersions.new)
60
+ add_step(Procedures::Packages::Update.new(:assumeyes => true))
61
+ add_step_with_context(Procedures::Installer::Upgrade)
62
+ add_step(Procedures::Installer::UpgradeRakeTask)
63
+ end
64
+ end
65
+
66
+ class PostMigrations < Abstract
67
+ upgrade_metadata do
68
+ description 'Procedures after migrating to Satellite 6.9'
69
+ tags :post_migrations
70
+ end
71
+
72
+ def compose
73
+ add_step(Procedures::Service::Start.new)
74
+ add_steps(find_procedures(:post_migrations))
75
+ end
76
+ end
77
+
78
+ class PostUpgradeChecks < Abstract
79
+ upgrade_metadata do
80
+ description 'Checks after upgrading to Satellite 6.9'
81
+ tags :post_upgrade_checks
82
+ run_strategy :fail_slow
83
+ end
84
+
85
+ def compose
86
+ add_steps(find_checks(:default))
87
+ add_steps(find_checks(:post_upgrade))
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,89 @@
1
+ module Scenarios::Satellite_6_9_z
2
+ class Abstract < ForemanMaintain::Scenario
3
+ def self.upgrade_metadata(&block)
4
+ metadata do
5
+ tags :upgrade_scenario
6
+ confine do
7
+ feature(:satellite) &&
8
+ (feature(:satellite).current_minor_version == '6.9' || \
9
+ ForemanMaintain.upgrade_in_progress == '6.9.z')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '6.9.z'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Satellite 6.9.z'
23
+ tags :pre_upgrade_checks
24
+ run_strategy :fail_slow
25
+ end
26
+
27
+ def compose
28
+ add_steps(find_checks(:default))
29
+ add_steps(find_checks(:pre_upgrade))
30
+ add_step(Checks::Repositories::Validate.new(:version => '6.9'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Satellite 6.9.z'
37
+ tags :pre_migrations
38
+ end
39
+
40
+ def compose
41
+ add_steps(find_procedures(:pre_migrations))
42
+ add_step(Procedures::Service::Stop.new)
43
+ end
44
+ end
45
+
46
+ class Migrations < Abstract
47
+ upgrade_metadata do
48
+ description 'Migration scripts to Satellite 6.9.z'
49
+ tags :migrations
50
+ end
51
+
52
+ def set_context_mapping
53
+ context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
54
+ end
55
+
56
+ def compose
57
+ add_step(Procedures::Repositories::Setup.new(:version => '6.9'))
58
+ add_step(Procedures::Packages::UnlockVersions.new)
59
+ add_step(Procedures::Packages::Update.new(:assumeyes => true))
60
+ add_step_with_context(Procedures::Installer::Upgrade)
61
+ add_step(Procedures::Installer::UpgradeRakeTask)
62
+ end
63
+ end
64
+
65
+ class PostMigrations < Abstract
66
+ upgrade_metadata do
67
+ description 'Procedures after migrating to Satellite 6.9.z'
68
+ tags :post_migrations
69
+ end
70
+
71
+ def compose
72
+ add_step(Procedures::Service::Start.new)
73
+ add_steps(find_procedures(:post_migrations))
74
+ end
75
+ end
76
+
77
+ class PostUpgradeChecks < Abstract
78
+ upgrade_metadata do
79
+ description 'Checks after upgrading to Satellite 6.9.z'
80
+ tags :post_upgrade_checks
81
+ run_strategy :fail_slow
82
+ end
83
+
84
+ def compose
85
+ add_steps(find_checks(:default))
86
+ add_steps(find_checks(:post_upgrade))
87
+ end
88
+ end
89
+ end