foreman_maintain 1.7.4 → 1.8.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: 9cd7c83e3e9aa5d629b7c65334c4022e8923979a432a917570733afd4d9fef41
4
- data.tar.gz: bc2306bdcac1cb11c91f9105902bdac47cf9ad4ddd02a0774d25b035da4a67f5
3
+ metadata.gz: 8e99ddc1408ae68f584bbfc6e8798367e623e38f981682666f40cac91bb8f5f4
4
+ data.tar.gz: 173ee0cd4fbce206437d53937eaf0489111e4c6b57eac8b04943c9468eb5ab40
5
5
  SHA512:
6
- metadata.gz: 8ae072acb083a756c5e4e3eb6b9c87f6f79ebfaa1a70e0385cc0f150078476c63d88c91b443d2b5d9ccb8a0f6c1ec3685f5c26600a147c7ed2f756c0530c6e72
7
- data.tar.gz: 76edef0a64cabe97dfb4f515dcc20be20f562418d0e6dbe5b58b27f52bde5821791afe152342c17170ed32d4e377072b35288b5a8c77266b1ff39fe5eaac7044
6
+ metadata.gz: 60a28996480d8564f5900a56d3f1494f9eb756d0a54c1bf3fee4c37fb5096a848db3a4ed2a6700e65d2fd4193bda13bebb4a50368ca0dbfd2ca1dccf9ea76d8e
7
+ data.tar.gz: c323322a2e40d116c34de3ed7430742caa127250024957aa4b2579b14bbc27fb271312a6d973d82533ef091ca77ead05de0cf61c005475da8e3766e910e35562
@@ -8,7 +8,7 @@ class Features::Installer < ForemanMaintain::Feature
8
8
  end
9
9
 
10
10
  def answers
11
- load_answers(configuration)
11
+ YAML.load_file(answer_file)
12
12
  end
13
13
 
14
14
  def configuration
@@ -28,11 +28,13 @@ class Features::Installer < ForemanMaintain::Feature
28
28
  end
29
29
 
30
30
  def config_files
31
- Dir.glob(File.join(config_directory, '**/*')) +
32
- [
33
- '/opt/puppetlabs/puppet/cache/foreman_cache_data',
34
- '/opt/puppetlabs/puppet/cache/pulpcore_cache_data',
35
- ]
31
+ paths = [
32
+ config_directory,
33
+ '/opt/puppetlabs/puppet/cache/foreman_cache_data',
34
+ '/opt/puppetlabs/puppet/cache/pulpcore_cache_data',
35
+ ]
36
+ paths << answer_file unless answer_file.start_with?("#{config_directory}/")
37
+ paths
36
38
  end
37
39
 
38
40
  def last_scenario
@@ -80,8 +82,8 @@ class Features::Installer < ForemanMaintain::Feature
80
82
 
81
83
  private
82
84
 
83
- def load_answers(config)
84
- YAML.load_file(config[:answer_file])
85
+ def answer_file
86
+ configuration[:answer_file]
85
87
  end
86
88
 
87
89
  def last_scenario_config
@@ -68,8 +68,8 @@ class Features::Pulpcore < ForemanMaintain::Feature
68
68
 
69
69
  def self.pulpcore_common_services
70
70
  [
71
- ForemanMaintain::Utils.system_service('pulpcore-api', 10, :socket => 'pulpcore-api'),
72
- ForemanMaintain::Utils.system_service('pulpcore-content', 10, :socket => 'pulpcore-content'),
71
+ ForemanMaintain::Utils.system_service('pulpcore-api', 20, :socket => 'pulpcore-api'),
72
+ ForemanMaintain::Utils.system_service('pulpcore-content', 20, :socket => 'pulpcore-content'),
73
73
  ]
74
74
  end
75
75
  end
@@ -11,11 +11,11 @@ class Features::Satellite < ForemanMaintain::Feature
11
11
  end
12
12
 
13
13
  def target_version
14
- '6.16'
14
+ satellite_maintain_target_version
15
15
  end
16
16
 
17
17
  def current_version
18
- @current_version ||= package_version(package_name) || version_from_source
18
+ @current_version ||= package_version(package_name)
19
19
  end
20
20
 
21
21
  def package_name
@@ -25,10 +25,4 @@ class Features::Satellite < ForemanMaintain::Feature
25
25
  def module_name
26
26
  'satellite'
27
27
  end
28
-
29
- private
30
-
31
- def version_from_source
32
- version(File.read('/usr/share/foreman/lib/satellite/version.rb')[/6\.\d\.\d/])
33
- end
34
28
  end
@@ -4,15 +4,14 @@ module Scenarios::Satellite
4
4
  metadata do
5
5
  tags :upgrade_scenario
6
6
  confine do
7
- (feature(:instance).downstream&.current_minor_version == '6.15' || \
8
- ForemanMaintain.upgrade_in_progress == '6.16')
7
+ feature(:instance).downstream&.satellite_upgrade_allowed?
9
8
  end
10
9
  instance_eval(&block)
11
10
  end
12
11
  end
13
12
 
14
13
  def target_version
15
- '6.16'
14
+ feature(:instance).downstream&.satellite_maintain_target_version
16
15
  end
17
16
  end
18
17
 
@@ -1,6 +1,8 @@
1
1
  module ForemanMaintain
2
2
  module Concerns
3
3
  module Downstream
4
+ SATELLITE_MAINTAIN_CONFIG = '/usr/share/satellite-maintain/config.yml'.freeze
5
+
4
6
  def current_version
5
7
  raise NotImplementedError
6
8
  end
@@ -46,8 +48,25 @@ module ForemanMaintain
46
48
  %w[satellite-maintain satellite-maintain]
47
49
  end
48
50
 
51
+ def satellite_maintain_target_version
52
+ satellite_maintain_config['current_satellite_version']
53
+ end
54
+
55
+ def satellite_upgrade_allowed?
56
+ current_minor_version == satellite_maintain_config['previous_satellite_version'] ||
57
+ ForemanMaintain.upgrade_in_progress == satellite_maintain_target_version
58
+ end
59
+
49
60
  private
50
61
 
62
+ def satellite_maintain_config
63
+ if File.exist?(SATELLITE_MAINTAIN_CONFIG)
64
+ YAML.load_file(SATELLITE_MAINTAIN_CONFIG)
65
+ else
66
+ raise "Could not load satellite-maintain configuration file #{SATELLITE_MAINTAIN_CONFIG}."
67
+ end
68
+ end
69
+
51
70
  def rh_repos(server_version)
52
71
  server_version = version(server_version)
53
72
  rh_repos = main_rh_repos
@@ -71,10 +90,6 @@ module ForemanMaintain
71
90
  "rhel-#{el_major_version}-for-x86_64-appstream-rpms",
72
91
  ]
73
92
  end
74
-
75
- def version_from_source
76
- raise NotImplementedError
77
- end
78
93
  end
79
94
  end
80
95
  end
@@ -36,7 +36,11 @@ module ForemanMaintain
36
36
  PHASES.each do |phase|
37
37
  return run_rollback if quit?
38
38
 
39
- run_phase(phase)
39
+ if skip?(phase)
40
+ skip_phase(phase)
41
+ else
42
+ run_phase(phase)
43
+ end
40
44
  end
41
45
 
42
46
  finish_update unless quit?
@@ -90,12 +94,22 @@ module ForemanMaintain
90
94
  @ask_to_confirm_update = phase == :pre_update_checks
91
95
  end
92
96
 
97
+ def skip_phase(skipped_phase)
98
+ with_non_empty_scenario(skipped_phase) do |scenario|
99
+ @reporter.before_scenario_starts(scenario)
100
+ @reporter.puts <<~MESSAGE
101
+ Skipping #{skipped_phase} phase as it was already run before.
102
+ MESSAGE
103
+ @reporter.after_scenario_finishes(scenario)
104
+ end
105
+ end
106
+
93
107
  private
94
108
 
95
109
  def rollback_pre_migrations
96
110
  raise "Unexpected phase #{phase}, expecting pre_migrations" unless phase == :pre_migrations
97
111
 
98
- rollback_needed = scenario(:pre_migrations).steps.any? { |s| s.executed? && s.success? }
112
+ rollback_needed = find_scenario(:pre_migrations).steps.any? { |s| s.executed? && s.success? }
99
113
  if rollback_needed
100
114
  @quit = false
101
115
  # prevent the unnecessary confirmation questions
@@ -110,7 +124,7 @@ module ForemanMaintain
110
124
  end
111
125
 
112
126
  def with_non_empty_scenario(phase)
113
- next_scenario = scenario(phase)
127
+ next_scenario = find_scenario(phase)
114
128
  unless next_scenario.nil? || next_scenario.steps.empty?
115
129
  yield next_scenario
116
130
  end
@@ -153,6 +167,11 @@ module ForemanMaintain
153
167
  @ask_to_confirm_update = false
154
168
  end
155
169
 
170
+ def skip?(next_phase)
171
+ # the next_phase was run before the current phase
172
+ PHASES.index(next_phase) < PHASES.index(phase)
173
+ end
174
+
156
175
  def phase=(phase)
157
176
  raise "Unknown phase #{phase}" unless PHASES.include?(phase)
158
177
 
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.7.4'.freeze
2
+ VERSION = '1.8.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: 1.7.4
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-18 00:00:00.000000000 Z
11
+ date: 2024-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -410,7 +410,7 @@ homepage: https://github.com/theforeman/foreman_maintain
410
410
  licenses:
411
411
  - GPL-3.0
412
412
  metadata: {}
413
- post_install_message:
413
+ post_install_message:
414
414
  rdoc_options: []
415
415
  require_paths:
416
416
  - lib
@@ -429,7 +429,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
429
429
  version: '0'
430
430
  requirements: []
431
431
  rubygems_version: 3.3.27
432
- signing_key:
432
+ signing_key:
433
433
  specification_version: 4
434
434
  summary: Foreman maintenance tool belt
435
435
  test_files: []