foreman_maintain 0.9.3 → 1.0.0

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: dcef2fd68b963d566c30be2531b1f09bf71da02eb8cd06e2c280f9d4a6222fc0
4
- data.tar.gz: 5a1448015d72fe8e8ae19c73eff430b13387c699689a5dbbdd0b73bbbe49c9f0
3
+ metadata.gz: bc78f39bf65ff7aa89be6ba1dda201de03f6d9a4b637599e5afd3d489ac4495d
4
+ data.tar.gz: 5554b12a68af2a4710ef7725d39079fbe7452b280b40b9ebfe0bd23cad058f40
5
5
  SHA512:
6
- metadata.gz: 348bedd61056cffd63610b9a91d0e8c2a31e3012ec0e41880e05195ae840a61bd14c7d84ea23715cae771272f555b95f05085e4fb1fefc01a4f1a1f84880648d
7
- data.tar.gz: 76f1871c0edb9671ec0a45fec272afed10ae05bb9ebab4b92ecc3f7960bb1a7625b9267eba032fb6335fac1e8cc32116047e87dab109fb8745ce37e212399768
6
+ metadata.gz: d68910821f5bcbdc2267d7fa5201fe348b4f32af27531d15a621567aaef88dc52bfdc17e3fcaf6ec70899514c103d501b785edd2cb6c9100bb50762b7050236e
7
+ data.tar.gz: bede7c7b5521c991a83ca714fbdc10bee1df94d992daa4d54c142a51717bfae130f2e5ddf4b789f5c34274a0eb766fed0d62b0bd1f09017c14c0a9378402307c
@@ -0,0 +1,18 @@
1
+ module Checks
2
+ module Pulpcore
3
+ class GroupOwnershipCheck < ForemanMaintain::Check
4
+ metadata do
5
+ description 'Check the group owner of /var/lib/pulp directory'
6
+ label :group_ownership_check_of_pulp_content
7
+ manual_detection
8
+ end
9
+
10
+ def run
11
+ group_id = File.stat('/var/lib/pulp/').gid
12
+ if Etc.getgrgid(group_id).name != 'pulp'
13
+ fail! "Please run 'foreman-maintain prep-6.10-upgrade' prior to upgrading."
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,89 @@
1
+ module Scenarios::Capsule_7_0
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.10' || \
9
+ ForemanMaintain.upgrade_in_progress == '7.0')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '7.0'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Capsule 7.0'
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 => '7.0'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Capsule 7.0'
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 7.0'
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 => '7.0'))
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 7.0'
67
+ tags :post_migrations
68
+ end
69
+
70
+ def compose
71
+ add_step(Procedures::RefreshFeatures)
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 Capsule 7.0'
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
@@ -0,0 +1,89 @@
1
+ module Scenarios::Capsule_7_0_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 == '7.0' || \
9
+ ForemanMaintain.upgrade_in_progress == '7.0.z')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '7.0.z'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Capsule 7.0.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 => '7.0'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Capsule 7.0.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 7.0.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 => '7.0'))
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 7.0.z'
67
+ tags :post_migrations
68
+ end
69
+
70
+ def compose
71
+ add_step(Procedures::RefreshFeatures)
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 Capsule 7.0.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
@@ -25,6 +25,7 @@ module Scenarios::Satellite_6_10
25
25
  end
26
26
 
27
27
  def compose
28
+ add_step(Checks::Pulpcore::GroupOwnershipCheck)
28
29
  add_step(Checks::Puppet::WarnAboutPuppetRemoval)
29
30
  add_step(Checks::CheckForNewerPackages.new(:packages => [foreman_plugin_name('katello'),
30
31
  'python3-pulp-2to3-migration'],
@@ -61,13 +62,6 @@ module Scenarios::Satellite_6_10
61
62
  context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
62
63
  end
63
64
 
64
- def check_var_lib_pulp
65
- group_id = File.stat('/var/lib/pulp/').gid
66
- if Etc.getgrgid(group_id).name != 'pulp'
67
- raise "Please run 'foreman-maintain prep-6.10-upgrade' prior to upgrading."
68
- end
69
- end
70
-
71
65
  def pulp3_switchover_steps
72
66
  add_step(Procedures::Service::Enable.
73
67
  new(:only => Features::Pulpcore.pulpcore_migration_services))
@@ -79,7 +73,6 @@ module Scenarios::Satellite_6_10
79
73
  end
80
74
 
81
75
  def compose
82
- check_var_lib_pulp
83
76
  unless check_min_version(foreman_plugin_name('katello'), '4.0')
84
77
  pulp3_switchover_steps
85
78
  end
@@ -0,0 +1,93 @@
1
+ module Scenarios::Satellite_7_0
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.10' || \
9
+ ForemanMaintain.upgrade_in_progress == '7.0')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '7.0'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Satellite 7.0'
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
+
31
+ add_step(Checks::Foreman::CheckpointSegments)
32
+ add_step(Checks::Repositories::Validate.new(:version => '7.0'))
33
+ end
34
+ end
35
+
36
+ class PreMigrations < Abstract
37
+ upgrade_metadata do
38
+ description 'Procedures before migrating to Satellite 7.0'
39
+ tags :pre_migrations
40
+ end
41
+
42
+ def compose
43
+ add_steps(find_procedures(:pre_migrations))
44
+ add_step(Procedures::Service::Stop.new)
45
+ end
46
+ end
47
+
48
+ class Migrations < Abstract
49
+ upgrade_metadata do
50
+ description 'Migration scripts to Satellite 7.0'
51
+ tags :migrations
52
+ run_strategy :fail_fast
53
+ end
54
+
55
+ def set_context_mapping
56
+ context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
57
+ end
58
+
59
+ def compose
60
+ add_step(Procedures::Repositories::Setup.new(:version => '7.0'))
61
+ add_step(Procedures::Packages::UnlockVersions.new)
62
+ add_step(Procedures::Packages::Update.new(:assumeyes => true))
63
+ add_step_with_context(Procedures::Installer::Upgrade)
64
+ add_step(Procedures::Installer::UpgradeRakeTask)
65
+ end
66
+ end
67
+
68
+ class PostMigrations < Abstract
69
+ upgrade_metadata do
70
+ description 'Procedures after migrating to Satellite 7.0'
71
+ tags :post_migrations
72
+ end
73
+
74
+ def compose
75
+ add_step(Procedures::RefreshFeatures)
76
+ add_step(Procedures::Service::Start.new)
77
+ add_steps(find_procedures(:post_migrations))
78
+ end
79
+ end
80
+
81
+ class PostUpgradeChecks < Abstract
82
+ upgrade_metadata do
83
+ description 'Checks after upgrading to Satellite 7.0'
84
+ tags :post_upgrade_checks
85
+ run_strategy :fail_slow
86
+ end
87
+
88
+ def compose
89
+ add_steps(find_checks(:default))
90
+ add_steps(find_checks(:post_upgrade))
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,90 @@
1
+ module Scenarios::Satellite_7_0_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 == '7.0' || \
9
+ ForemanMaintain.upgrade_in_progress == '7.0.z')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '7.0.z'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Satellite 7.0.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 => '7.0'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Satellite 7.0.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 7.0.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 => '7.0'))
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 7.0.z'
68
+ tags :post_migrations
69
+ end
70
+
71
+ def compose
72
+ add_step(Procedures::RefreshFeatures)
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 7.0.z'
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
@@ -74,21 +74,36 @@ module ForemanMaintain
74
74
 
75
75
  def ansible_repo(server_version)
76
76
  if server_version >= version('6.8')
77
- "rhel-#{el_major_version}-server-ansible-2.9-rpms"
77
+ ansible_version = '2.9'
78
78
  elsif server_version >= version('6.6')
79
- "rhel-#{el_major_version}-server-ansible-2.8-rpms"
79
+ ansible_version = '2.8'
80
80
  elsif server_version >= version('6.4')
81
- "rhel-#{el_major_version}-server-ansible-2.6-rpms"
81
+ ansible_version = '2.6'
82
82
  end
83
+
84
+ if el7?
85
+ "rhel-#{el_major_version}-server-ansible-#{ansible_version}-rpms"
86
+ else
87
+ "ansible-#{ansible_version}-for-rhel-#{el_major_version}-x86_64-rpms"
88
+ end
89
+ end
90
+
91
+ def use_beta_repos?
92
+ ENV['FOREMAN_MAINTAIN_USE_BETA'] == '1'
83
93
  end
84
94
 
85
95
  def product_specific_repos(full_version)
86
- repos = []
87
- repos << if ENV['FOREMAN_MAINTAIN_USE_BETA'] == '1'
88
- "rhel-server-#{el_major_version}-#{package_name}-6-beta-rpms"
89
- else
90
- "rhel-#{el_major_version}-server-#{package_name}-#{full_version}-rpms"
91
- end
96
+ maj_version = full_version[0]
97
+ repos = if el7? && use_beta_repos?
98
+ ["rhel-server-#{el_major_version}-#{package_name}-#{maj_version}-beta-rpms"]
99
+ elsif el7?
100
+ ["rhel-#{el_major_version}-server-#{package_name}-#{full_version}-rpms"]
101
+ elsif use_beta_repos?
102
+ ["#{package_name}-#{maj_version}-beta-for-rhel-#{el_major_version}-x86_64-rpms"]
103
+ else
104
+ ["#{package_name}-#{full_version}-for-rhel-#{el_major_version}-x86_64-rpms"]
105
+ end
106
+
92
107
  repos << puppet4_repo(full_version) unless puppet4_repo(full_version).nil?
93
108
  repos.concat(common_repos(full_version))
94
109
  end
@@ -101,22 +116,35 @@ module ForemanMaintain
101
116
  end
102
117
 
103
118
  def common_repos(full_version)
104
- repos_arrary = if ENV['FOREMAN_MAINTAIN_USE_BETA'] == '1'
105
- ["rhel-#{el_major_version}-server-satellite-maintenance-6-beta-rpms",
106
- "rhel-#{el_major_version}-server-satellite-tools-6-beta-rpms"]
107
- else
108
- ["rhel-#{el_major_version}-server-satellite-maintenance-6-rpms",
109
- "rhel-#{el_major_version}-server-satellite-tools-#{full_version}-rpms"]
110
- end
111
-
112
- return repos_arrary.first(1) if feature(:satellite)
113
-
114
- repos_arrary
119
+ sat_maint_version = if version(full_version) >= version('7.0') && !use_beta_repos?
120
+ full_version
121
+ else
122
+ full_version[0]
123
+ end
124
+
125
+ # rubocop:disable Metrics/LineLength
126
+ repos = if el7? && use_beta_repos?
127
+ ["rhel-#{el_major_version}-server-satellite-maintenance-#{sat_maint_version}-beta-rpms"]
128
+ elsif el7?
129
+ ["rhel-#{el_major_version}-server-satellite-maintenance-#{sat_maint_version}-rpms"]
130
+ elsif use_beta_repos?
131
+ ["satellite-maintenance-#{sat_maint_version}-beta-for-rhel-#{el_major_version}-x86_64-rpms"]
132
+ else
133
+ ["satellite-maintenance-#{sat_maint_version}-for-rhel-#{el_major_version}-x86_64-rpms"]
134
+ end
135
+ # rubocop:enable Metrics/LineLength
136
+
137
+ repos
115
138
  end
116
139
 
117
140
  def main_rh_repos
118
- ["rhel-#{el_major_version}-server-rpms",
119
- "rhel-server-rhscl-#{el_major_version}-rpms"]
141
+ if el7?
142
+ ["rhel-#{el_major_version}-server-rpms",
143
+ "rhel-server-rhscl-#{el_major_version}-rpms"]
144
+ else
145
+ ["rhel-#{el_major_version}-for-x86_64-baseos-rpms",
146
+ "rhel-#{el_major_version}-for-x86_64-appstream-rpms"]
147
+ end
120
148
  end
121
149
 
122
150
  def version_from_source
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.9.3'.freeze
2
+ VERSION = '1.0.0'.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: 0.9.3
4
+ version: 1.0.0
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: 2021-11-24 00:00:00.000000000 Z
11
+ date: 2021-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -169,6 +169,7 @@ files:
169
169
  - definitions/checks/original_assets.rb
170
170
  - definitions/checks/package_manager/yum/validate_yum_config.rb
171
171
  - definitions/checks/pulpcore/db_up.rb
172
+ - definitions/checks/pulpcore/group_ownership_check.rb
172
173
  - definitions/checks/puppet/provide_upgrade_guide.rb
173
174
  - definitions/checks/puppet/verify_no_empty_cacert_requests.rb
174
175
  - definitions/checks/puppet/warn_about_puppet_removal.rb
@@ -335,6 +336,8 @@ files:
335
336
  - definitions/scenarios/upgrade_to_capsule_6_8_z.rb
336
337
  - definitions/scenarios/upgrade_to_capsule_6_9.rb
337
338
  - definitions/scenarios/upgrade_to_capsule_6_9_z.rb
339
+ - definitions/scenarios/upgrade_to_capsule_7_0.rb
340
+ - definitions/scenarios/upgrade_to_capsule_7_0_z.rb
338
341
  - definitions/scenarios/upgrade_to_satellite_6_10.rb
339
342
  - definitions/scenarios/upgrade_to_satellite_6_10_z.rb
340
343
  - definitions/scenarios/upgrade_to_satellite_6_2.rb
@@ -353,6 +356,8 @@ files:
353
356
  - definitions/scenarios/upgrade_to_satellite_6_8_z.rb
354
357
  - definitions/scenarios/upgrade_to_satellite_6_9.rb
355
358
  - definitions/scenarios/upgrade_to_satellite_6_9_z.rb
359
+ - definitions/scenarios/upgrade_to_satellite_7_0.rb
360
+ - definitions/scenarios/upgrade_to_satellite_7_0_z.rb
356
361
  - extras/foreman-maintain.sh
357
362
  - extras/foreman_protector/foreman-protector.conf
358
363
  - extras/foreman_protector/foreman-protector.py