foreman_maintain 0.8.0 → 0.8.1

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: ed8b16b2a22acb7bf2e2768976f2df46eb6a1b51b883904cbee0bb180869c5a4
4
- data.tar.gz: 46473f96dba47ffc94f08fbb15fa031073852cdc234c8c701d5568a7727d269d
3
+ metadata.gz: 4894231356aabd2a87f57c49952e1860f762908b98770e96d1b60118808927a1
4
+ data.tar.gz: 92dc7d469e6ac81bf6e7278225077c189d302157ee0d7c9e930ed53a2a5ad029
5
5
  SHA512:
6
- metadata.gz: 76da2fe52b25ac48af18295caaa92dad1e2cb106a8aaded53adc02804da1ef2c021a6d336e10e4abea87d6aed1f9950a9b994cc6dba075b8b116a31ea9c6b706
7
- data.tar.gz: d25955e6f87bfb863d050935bf4ed253c2afa55e1552ec17edcc76500c6d563d7fe318b84d68877c942c63facdd3c93d973591df5e93fedd9fd445a4ff4c845a
6
+ metadata.gz: c3b440096f343c3ce67b2ee8a94a265eb53141d4c57f6bd9fb49562ba9f3bb8ba8a8886875917c88df7324e1993902b51a125ba02760ab9cfa1820e1d1d9b323
7
+ data.tar.gz: 17eb800a81f97ff503aa8fbe87c55918dcb99946928079eeab9288c93972a7f287e5acc4d699e8c5294c196bdabb2da978b363d79015ed6b796688c7c063a7a9
@@ -0,0 +1,29 @@
1
+ class Checks::NonRhPackages < ForemanMaintain::Check
2
+ metadata do
3
+ label :non_rh_packages
4
+ description 'Check if system has any non Red Hat RPMs installed (e.g.: Fedora)'
5
+ tags :pre_upgrade
6
+ confine do
7
+ feature(:instance).downstream
8
+ end
9
+ end
10
+
11
+ def run
12
+ rpm_query_format = '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH} : %{VENDOR}\n'
13
+ all_packages = package_manager.list_installed_packages(rpm_query_format)
14
+ non_rh_packages = all_packages - all_packages.grep(Regexp.union(rh_regexp_list))
15
+ assert(non_rh_packages.empty?, error_msg(non_rh_packages), :warn => true)
16
+ end
17
+
18
+ def error_msg(packages)
19
+ "Found #{packages.count} unexpected non Red Hat Package(s) installed!\
20
+ \nPackage : Vendor\n#{packages.join("\n")}"
21
+ end
22
+
23
+ def rh_regexp_list
24
+ [/Red Hat, Inc\./, /Red Hat Inc./, /-apache/, /-foreman-proxy/, /-foreman-client/,
25
+ /-puppet-client/, /-qpid-broker/, /-qpid-client-cert/, /-qpid-router-client/,
26
+ /-qpid-router-server/, /java-client/, /pulp-client/, /katello-default-ca/, /katello-server-ca/,
27
+ /katello-ca-consumer/, /gpg-pubkey/, /-tomcat/]
28
+ end
29
+ end
@@ -37,6 +37,6 @@ class Features::DynflowSidekiq < ForemanMaintain::Feature
37
37
  end
38
38
 
39
39
  def configured_instances
40
- Dir['/etc/foreman/dynflow/*'].map { |config| File.basename(config, '.yml') }
40
+ Dir['/etc/foreman/dynflow/*.yml'].map { |config| File.basename(config, '.yml') }
41
41
  end
42
42
  end
@@ -34,4 +34,10 @@ class Features::Pulp < ForemanMaintain::Feature
34
34
  '/etc/default/pulp_workers'
35
35
  ]
36
36
  end
37
+
38
+ def exclude_from_backup
39
+ # Exclude /var/lib/pulp/katello-export and /var/lib/pulp/cache
40
+ # since the tar is run from /var/lib/pulp, list subdir paths only
41
+ ['katello-export', 'cache']
42
+ end
37
43
  end
@@ -30,7 +30,7 @@ module Procedures::Backup
30
30
  feature(:tar).run(
31
31
  :archive => File.join(@backup_dir, 'pulp_data.tar'),
32
32
  :command => 'create',
33
- :exclude => ['var/lib/pulp/katello-export'],
33
+ :exclude => feature(:pulp2).exclude_from_backup,
34
34
  :listed_incremental => File.join(@backup_dir, '.pulp.snar'),
35
35
  :transform => 's,^,var/lib/pulp/,S',
36
36
  :volume_size => @tar_volume_size,
@@ -11,11 +11,11 @@ class Procedures::Prep610Upgrade < ForemanMaintain::Procedure
11
11
  def run
12
12
  puts time_warning
13
13
  with_spinner('Updating filesystem permissions for Pulp 3') do |spinner|
14
- spinner.update('$ chmod -R g+rwX /var/lib/pulp/content')
14
+ spinner.update('# chmod -R g=rwX /var/lib/pulp/content')
15
15
  FileUtils.chmod_R 'g=rwX', '/var/lib/pulp/content'
16
- spinner.update("$ find /var/lib/pulp/content -type d -perm -g-s -exec chmod g+s {} \;")
17
- execute!('find /var/lib/pulp/content -type d -perm -g-s -exec chmod g+s {} \;')
18
- spinner.update('$ chown -R :pulp /var/lib/pulp/content')
16
+ spinner.update("# find /var/lib/pulp/content -type d \! -perm -g+s -exec chmod g+s {} +")
17
+ execute!('find /var/lib/pulp/content -type d \! -perm -g+s -exec chmod g+s {} +')
18
+ spinner.update('# chgrp -R pulp /var/lib/pulp/content')
19
19
  FileUtils.chown_R nil, 'pulp', '/var/lib/pulp/content'
20
20
  end
21
21
  end
@@ -2,7 +2,7 @@ module Procedures::Restore
2
2
  class RegenerateQueues < ForemanMaintain::Procedure
3
3
  metadata do
4
4
  advanced_run false
5
- description 'Regenerate required activemq and qpidd queues while restoring online backup'
5
+ description 'Regenerate required activemq and/or qpidd queues while restoring online backup'
6
6
  confine do
7
7
  feature(:pulp2)
8
8
  end
@@ -31,7 +31,7 @@ module Procedures::Restore
31
31
 
32
32
  def run
33
33
  with_spinner('Resetting the queues') do |spinner|
34
- regenerate_activemq_queues(spinner)
34
+ regenerate_activemq_queues(spinner) if feature(:candlepin)
35
35
  regenerate_qpidd_queues(spinner)
36
36
  spinner.update('Queues created successfully')
37
37
  end
@@ -0,0 +1,88 @@
1
+ module Scenarios::Capsule_6_10
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.10')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '6.10'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Capsule 6.10'
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.10'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Capsule 6.10'
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.10'
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.10'))
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.10'
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.10'
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_10_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.10' || \
9
+ ForemanMaintain.upgrade_in_progress == '6.10.z')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '6.10.z'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Capsule 6.10.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.10'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Capsule 6.10.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.10.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.10'))
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.10.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.10.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_10
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.10')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '6.10'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Satellite 6.10'
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.10'))
32
+ end
33
+ end
34
+
35
+ class PreMigrations < Abstract
36
+ upgrade_metadata do
37
+ description 'Procedures before migrating to Satellite 6.10'
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.10'
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.10'))
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.10'
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.10'
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_10_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.10' || \
9
+ ForemanMaintain.upgrade_in_progress == '6.10.z')
10
+ end
11
+ instance_eval(&block)
12
+ end
13
+ end
14
+
15
+ def target_version
16
+ '6.10.z'
17
+ end
18
+ end
19
+
20
+ class PreUpgradeCheck < Abstract
21
+ upgrade_metadata do
22
+ description 'Checks before upgrading to Satellite 6.10.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.10'))
31
+ end
32
+ end
33
+
34
+ class PreMigrations < Abstract
35
+ upgrade_metadata do
36
+ description 'Procedures before migrating to Satellite 6.10.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.10.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.10'))
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.10.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.10.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
@@ -71,6 +71,14 @@ module ForemanMaintain::PackageManager
71
71
  sys.execute(find_cmd).split("\n")
72
72
  end
73
73
 
74
+ def list_installed_packages(queryfm = '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n')
75
+ # The queryfm should only include valid tag(s) as per `rpm --querytag` list.
76
+ # If any special formatting is required with querytag then it should be provided with tag i.e,
77
+ # querytag = "--%{VENDOR}"
78
+ # The queryfm string must end with '\n'
79
+ sys.execute!("rpm -qa --qf '#{queryfm}'").split("\n")
80
+ end
81
+
74
82
  private
75
83
 
76
84
  def protector_config
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.8.0'.freeze
2
+ VERSION = '0.8.1'.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.8.0
4
+ version: 0.8.1
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-04-09 00:00:00.000000000 Z
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -147,6 +147,7 @@ files:
147
147
  - definitions/checks/maintenance_mode/check_consistency.rb
148
148
  - definitions/checks/mongo/db_up.rb
149
149
  - definitions/checks/mongo/tools_installed.rb
150
+ - definitions/checks/non_rh_packages.rb
150
151
  - definitions/checks/original_assets.rb
151
152
  - definitions/checks/package_manager/yum/validate_yum_config.rb
152
153
  - definitions/checks/pulpcore/db_up.rb
@@ -298,10 +299,14 @@ files:
298
299
  - definitions/scenarios/prep_6_10_upgrade.rb
299
300
  - definitions/scenarios/restore.rb
300
301
  - definitions/scenarios/services.rb
302
+ - definitions/scenarios/upgrade_to_capsule_6_10.rb
303
+ - definitions/scenarios/upgrade_to_capsule_6_10_z.rb
301
304
  - definitions/scenarios/upgrade_to_capsule_6_8.rb
302
305
  - definitions/scenarios/upgrade_to_capsule_6_8_z.rb
303
306
  - definitions/scenarios/upgrade_to_capsule_6_9.rb
304
307
  - definitions/scenarios/upgrade_to_capsule_6_9_z.rb
308
+ - definitions/scenarios/upgrade_to_satellite_6_10.rb
309
+ - definitions/scenarios/upgrade_to_satellite_6_10_z.rb
305
310
  - definitions/scenarios/upgrade_to_satellite_6_2.rb
306
311
  - definitions/scenarios/upgrade_to_satellite_6_2_z.rb
307
312
  - definitions/scenarios/upgrade_to_satellite_6_3.rb