foreman_maintain 0.0.7 → 0.0.8
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 +4 -4
- data/README.md +4 -0
- data/definitions/features/katello_service.rb +57 -0
- data/definitions/scenarios/upgrade_to_satellite_6_2.rb +0 -1
- data/definitions/scenarios/upgrade_to_satellite_6_2_z.rb +75 -0
- data/definitions/scenarios/upgrade_to_satellite_6_3.rb +76 -0
- data/definitions/scenarios/upgrade_to_satellite_6_3_z.rb +75 -0
- data/lib/foreman_maintain/upgrade_runner.rb +17 -2
- data/lib/foreman_maintain/version.rb +1 -1
- data/lib/foreman_maintain/yaml_storage.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa7485ad5a283ccf2c2d057d39e7fda1c579fd4d
|
4
|
+
data.tar.gz: aff6077a5e552e388e4d270d38f8e0795dc4dffc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e3a2e5956ba633975aa415a923cd5f3621d941a1683b07d727d28810c9673db2776a7e04a8090144bb149e99cebfc045153d2399f6e28908f5cee9b76d5ae4a
|
7
|
+
data.tar.gz: 40b1aa56498bc6e80f88ca3330df6c7fff946146fde9879179735d82dab24ecf45778b66d79c7a91949f8c0dbf5f64913e80259bb6aa12a060798ffc65f472fd
|
data/README.md
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
class Features::KatelloService < ForemanMaintain::Feature
|
2
|
+
metadata do
|
3
|
+
label :katello_service
|
4
|
+
end
|
5
|
+
|
6
|
+
def make_stop(spinner, options = {})
|
7
|
+
services = find_services_for_only_filter(running_services, options)
|
8
|
+
if services.empty?
|
9
|
+
spinner.update 'No katello service running'
|
10
|
+
yield
|
11
|
+
else
|
12
|
+
begin
|
13
|
+
filters = "--only #{services.join(',')}"
|
14
|
+
spinner.update 'Stopping katello running services..'
|
15
|
+
execute!("katello-service stop #{filters}")
|
16
|
+
yield
|
17
|
+
ensure
|
18
|
+
spinner.update 'Starting the katello services..'
|
19
|
+
execute("katello-service start #{filters}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def make_start(spinner, options = {})
|
25
|
+
services = find_services_for_only_filter(stopped_services, options)
|
26
|
+
if services.empty?
|
27
|
+
spinner.update 'No katello service to start'
|
28
|
+
else
|
29
|
+
filters = "--only #{services.join(',')}"
|
30
|
+
spinner.update 'Starting the katello services..'
|
31
|
+
execute!("katello-service start #{filters}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def find_services_for_only_filter(curr_services, options)
|
38
|
+
defaults = { :only => [], :exclude => [] }
|
39
|
+
options = defaults.merge(options)
|
40
|
+
curr_services &= options[:only] unless options[:only].empty?
|
41
|
+
curr_services - options[:exclude]
|
42
|
+
end
|
43
|
+
|
44
|
+
def running_services
|
45
|
+
find_services_by_state(" -w 'running'")
|
46
|
+
end
|
47
|
+
|
48
|
+
def stopped_services
|
49
|
+
find_services_by_state(" -w 'dead'")
|
50
|
+
end
|
51
|
+
|
52
|
+
def find_services_by_state(state)
|
53
|
+
katello_service_names = execute("katello-service list|awk '{print $1}'").split(/\n/)
|
54
|
+
services_by_state = execute("systemctl --all |grep #{state}|awk '{print $1}'").split(/\n/)
|
55
|
+
(katello_service_names & services_by_state).map { |s| s.gsub('.service', '') }
|
56
|
+
end
|
57
|
+
end
|
@@ -45,7 +45,6 @@ module Scenarios::Satellite_6_2
|
|
45
45
|
add_step(Procedures::Repositories::Setup.new(:version => '6.2'))
|
46
46
|
add_step(Procedures::Packages::Update.new(:assumeyes => false))
|
47
47
|
add_step(Procedures::Installer::Upgrade.new)
|
48
|
-
add_steps(find_procedures(:label => :installer_upgrade))
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Scenarios::Satellite_6_2_z
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_to_satellite_6_2_z
|
6
|
+
confine do
|
7
|
+
feature(:downstream) && feature(:downstream).current_minor_version == '6.2'
|
8
|
+
end
|
9
|
+
instance_eval(&block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class PreUpgradeCheck < Abstract
|
15
|
+
upgrade_metadata do
|
16
|
+
description 'checks before upgrading to Satellite 6.2.z'
|
17
|
+
tags :pre_upgrade_checks
|
18
|
+
run_strategy :fail_slow
|
19
|
+
end
|
20
|
+
|
21
|
+
def compose
|
22
|
+
add_steps(find_checks(:default))
|
23
|
+
add_steps(find_checks(:pre_upgrade))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class PreMigrations < Abstract
|
28
|
+
upgrade_metadata do
|
29
|
+
description 'procedures before migrating to Satellite 6.2.z'
|
30
|
+
tags :pre_migrations
|
31
|
+
end
|
32
|
+
|
33
|
+
def compose
|
34
|
+
add_steps(find_procedures(:pre_migrations))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class Migrations < Abstract
|
39
|
+
upgrade_metadata do
|
40
|
+
description 'migration scripts to Satellite 6.2.z'
|
41
|
+
tags :migrations
|
42
|
+
end
|
43
|
+
|
44
|
+
def compose
|
45
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => false))
|
46
|
+
add_step(Procedures::Installer::Upgrade.new)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class PostMigrations < Abstract
|
51
|
+
upgrade_metadata do
|
52
|
+
description 'procedures after migrating to Satellite 6.2.z'
|
53
|
+
tags :post_migrations
|
54
|
+
end
|
55
|
+
|
56
|
+
def compose
|
57
|
+
add_steps(find_procedures(:post_migrations))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
class PostUpgradeChecks < Abstract
|
62
|
+
upgrade_metadata do
|
63
|
+
description 'checks after upgrading to Satellite 6.2.z'
|
64
|
+
tags :post_upgrade_checks
|
65
|
+
run_strategy :fail_slow
|
66
|
+
end
|
67
|
+
|
68
|
+
def compose
|
69
|
+
add_steps(find_checks(:default))
|
70
|
+
add_steps(find_checks(:post_upgrade))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
ForemanMaintain::UpgradeRunner.register_version('6.2.z', :upgrade_to_satellite_6_2_z)
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Scenarios::Satellite_6_3
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_to_satellite_6_3
|
6
|
+
confine do
|
7
|
+
feature(:downstream) && feature(:downstream).current_minor_version == '6.2'
|
8
|
+
end
|
9
|
+
instance_eval(&block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class PreUpgradeCheck < Abstract
|
15
|
+
upgrade_metadata do
|
16
|
+
description 'checks before upgrading to Satellite 6.3'
|
17
|
+
tags :pre_upgrade_checks
|
18
|
+
run_strategy :fail_slow
|
19
|
+
end
|
20
|
+
|
21
|
+
def compose
|
22
|
+
add_steps(find_checks(:default))
|
23
|
+
add_steps(find_checks(:pre_upgrade))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class PreMigrations < Abstract
|
28
|
+
upgrade_metadata do
|
29
|
+
description 'procedures before migrating to Satellite 6.3'
|
30
|
+
tags :pre_migrations
|
31
|
+
end
|
32
|
+
|
33
|
+
def compose
|
34
|
+
add_steps(find_procedures(:pre_migrations))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class Migrations < Abstract
|
39
|
+
upgrade_metadata do
|
40
|
+
description 'migration scripts to Satellite 6.3'
|
41
|
+
tags :migrations
|
42
|
+
end
|
43
|
+
|
44
|
+
def compose
|
45
|
+
add_step(Procedures::Repositories::Setup.new(:version => '6.3'))
|
46
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => false))
|
47
|
+
add_step(Procedures::Installer::Upgrade.new)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class PostMigrations < Abstract
|
52
|
+
upgrade_metadata do
|
53
|
+
description 'procedures after migrating to Satellite 6.3'
|
54
|
+
tags :post_migrations
|
55
|
+
end
|
56
|
+
|
57
|
+
def compose
|
58
|
+
add_steps(find_procedures(:post_migrations))
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class PostUpgradeChecks < Abstract
|
63
|
+
upgrade_metadata do
|
64
|
+
description 'checks after upgrading to Satellite 6.3'
|
65
|
+
tags :post_upgrade_checks
|
66
|
+
run_strategy :fail_slow
|
67
|
+
end
|
68
|
+
|
69
|
+
def compose
|
70
|
+
add_steps(find_checks(:default))
|
71
|
+
add_steps(find_checks(:post_upgrade))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
ForemanMaintain::UpgradeRunner.register_version('6.3', :upgrade_to_satellite_6_3)
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Scenarios::Satellite_6_3_z
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_to_satellite_6_3_z
|
6
|
+
confine do
|
7
|
+
feature(:downstream) && feature(:downstream).current_minor_version == '6.3'
|
8
|
+
end
|
9
|
+
instance_eval(&block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class PreUpgradeCheck < Abstract
|
15
|
+
upgrade_metadata do
|
16
|
+
description 'checks before upgrading to Satellite 6.3.z'
|
17
|
+
tags :pre_upgrade_checks
|
18
|
+
run_strategy :fail_slow
|
19
|
+
end
|
20
|
+
|
21
|
+
def compose
|
22
|
+
add_steps(find_checks(:default))
|
23
|
+
add_steps(find_checks(:pre_upgrade))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class PreMigrations < Abstract
|
28
|
+
upgrade_metadata do
|
29
|
+
description 'procedures before migrating to Satellite 6.3.z'
|
30
|
+
tags :pre_migrations
|
31
|
+
end
|
32
|
+
|
33
|
+
def compose
|
34
|
+
add_steps(find_procedures(:pre_migrations))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class Migrations < Abstract
|
39
|
+
upgrade_metadata do
|
40
|
+
description 'migration scripts to Satellite 6.3.z'
|
41
|
+
tags :migrations
|
42
|
+
end
|
43
|
+
|
44
|
+
def compose
|
45
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => false))
|
46
|
+
add_step(Procedures::Installer::Upgrade.new)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class PostMigrations < Abstract
|
51
|
+
upgrade_metadata do
|
52
|
+
description 'procedures after migrating to Satellite 6.3.z'
|
53
|
+
tags :post_migrations
|
54
|
+
end
|
55
|
+
|
56
|
+
def compose
|
57
|
+
add_steps(find_procedures(:post_migrations))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
class PostUpgradeChecks < Abstract
|
62
|
+
upgrade_metadata do
|
63
|
+
description 'checks after upgrading to Satellite 6.3.z'
|
64
|
+
tags :post_upgrade_checks
|
65
|
+
run_strategy :fail_slow
|
66
|
+
end
|
67
|
+
|
68
|
+
def compose
|
69
|
+
add_steps(find_checks(:default))
|
70
|
+
add_steps(find_checks(:post_upgrade))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
ForemanMaintain::UpgradeRunner.register_version('6.3.z', :upgrade_to_satellite_6_3_z)
|
@@ -67,6 +67,9 @@ module ForemanMaintain
|
|
67
67
|
run_phase(phase)
|
68
68
|
end
|
69
69
|
end
|
70
|
+
unless quit?
|
71
|
+
finish_upgrade
|
72
|
+
end
|
70
73
|
end
|
71
74
|
|
72
75
|
def run_rollback
|
@@ -76,13 +79,25 @@ module ForemanMaintain
|
|
76
79
|
end
|
77
80
|
end
|
78
81
|
|
82
|
+
def finish_upgrade
|
83
|
+
@finished = true
|
84
|
+
@reporter.hline
|
85
|
+
@reporter.puts <<-MESSAGE.strip_heredoc
|
86
|
+
Upgrade finished.
|
87
|
+
MESSAGE
|
88
|
+
end
|
89
|
+
|
79
90
|
def storage
|
80
91
|
ForemanMaintain.storage("upgrade_#{version}")
|
81
92
|
end
|
82
93
|
|
83
94
|
# serializes the state of the run to storage
|
84
95
|
def save
|
85
|
-
|
96
|
+
if @finished
|
97
|
+
storage.delete(:serialized)
|
98
|
+
else
|
99
|
+
storage[:serialized] = to_hash
|
100
|
+
end
|
86
101
|
storage.save
|
87
102
|
end
|
88
103
|
|
@@ -109,7 +124,7 @@ module ForemanMaintain
|
|
109
124
|
@reporter.before_scenario_starts(scenario)
|
110
125
|
@reporter.puts <<-MESSAGE.strip_heredoc
|
111
126
|
Skipping #{skipped_phase} phase as it was already run before.
|
112
|
-
To enforce to run the phase, use `upgrade
|
127
|
+
To enforce to run the phase, use `upgrade run --phase #{phase}`
|
113
128
|
MESSAGE
|
114
129
|
@reporter.after_scenario_finishes(scenario)
|
115
130
|
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.0.
|
4
|
+
version: 0.0.8
|
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: 2017-08-
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- definitions/features/foreman_database.rb
|
124
124
|
- definitions/features/foreman_proxy.rb
|
125
125
|
- definitions/features/foreman_tasks.rb
|
126
|
+
- definitions/features/katello_service.rb
|
126
127
|
- definitions/features/sync_plans.rb
|
127
128
|
- definitions/features/upstream.rb
|
128
129
|
- definitions/procedures/foreman_tasks/delete.rb
|
@@ -138,6 +139,9 @@ files:
|
|
138
139
|
- definitions/procedures/sync_plans/disable.rb
|
139
140
|
- definitions/procedures/sync_plans/enable.rb
|
140
141
|
- definitions/scenarios/upgrade_to_satellite_6_2.rb
|
142
|
+
- definitions/scenarios/upgrade_to_satellite_6_2_z.rb
|
143
|
+
- definitions/scenarios/upgrade_to_satellite_6_3.rb
|
144
|
+
- definitions/scenarios/upgrade_to_satellite_6_3_z.rb
|
141
145
|
- lib/foreman_maintain.rb
|
142
146
|
- lib/foreman_maintain/check.rb
|
143
147
|
- lib/foreman_maintain/cli.rb
|
@@ -207,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
211
|
version: '0'
|
208
212
|
requirements: []
|
209
213
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.
|
214
|
+
rubygems_version: 2.6.12
|
211
215
|
signing_key:
|
212
216
|
specification_version: 4
|
213
217
|
summary: Foreman maintenance tool belt
|