foreman_maintain 0.8.2 → 0.8.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7e6e1bff90945614408bb1ae3e73b9a12fd43d75d7d164da74c9292e87f7d56
4
- data.tar.gz: 8f7d7d509bd2e88738a9025bd53c2a09f21933a65c4d1ce617ade128a2473542
3
+ metadata.gz: 4153054fabffdccbe07a9eed2689b4352077c3c4be62b92042dc20c885677a76
4
+ data.tar.gz: 68d332ebb071f25e585c0e866b0a85fa7efccd3820640452afcd06f5910860cc
5
5
  SHA512:
6
- metadata.gz: 69b30ba9d0f4aa6bd74ac5ec609c8e6baaa26954aee7b50291c244dd90571546381ba7f929ec36466eae92a745e62f9ce5855a5f671c851b87a8cb5ecc69f82f
7
- data.tar.gz: 76f1d2b051c4b062e1719303b0b87c450847702b4dd2c784f7afa31195886e46e6fe44a342fad9d3d3d130ac514dc4addbb9bdff32cd03fb75a165024cc9f295
6
+ metadata.gz: e431d1063f9b866d5300cc8de0a07d72c4b6542c8e974c3bec906e77bab465d54b8b68285d2c85ad12453a28fe4a7e20fd9d3ad01cb4493c65f2930418d1c58f
7
+ data.tar.gz: d39d2fcaaa8b0e90ac9fefd56e66bdc30e695078e853e3006d79c1204d90b08c4a39f41196bbf55888c47a995be9e276e6dd8b84016e85ced883c8d91655ffa8
@@ -0,0 +1,9 @@
1
+ class Procedures::RefreshFeatures < ForemanMaintain::Procedure
2
+ metadata do
3
+ description 'Refresh detected features'
4
+ end
5
+
6
+ def run
7
+ ForemanMaintain.refresh_features
8
+ end
9
+ end
@@ -68,6 +68,7 @@ module Scenarios::Capsule_6_10
68
68
  end
69
69
 
70
70
  def compose
71
+ add_step(Procedures::RefreshFeatures)
71
72
  add_step(Procedures::Service::Start.new)
72
73
  add_steps(find_procedures(:post_migrations))
73
74
  end
@@ -70,6 +70,7 @@ module Scenarios::Satellite_6_10
70
70
  end
71
71
 
72
72
  def compose
73
+ add_step(Procedures::RefreshFeatures)
73
74
  add_step(Procedures::Service::Start.new)
74
75
  add_steps(find_procedures(:post_migrations))
75
76
  end
@@ -101,6 +101,10 @@ module ForemanMaintain
101
101
  @detector ||= Detector.new
102
102
  end
103
103
 
104
+ def refresh_features
105
+ @detector = Detector.new
106
+ end
107
+
104
108
  def reporter
105
109
  @reporter ||= ForemanMaintain::Reporter::CLIReporter.new
106
110
  end
@@ -152,23 +152,31 @@ module ForemanMaintain
152
152
  end
153
153
  end
154
154
 
155
- def self.interactive_option
155
+ # rubocop:disable Metrics/MethodLength
156
+ def self.interactive_option(opts = %w[assumeyes whitelist force])
156
157
  delete_duplicate_assumeyes_if_any
157
158
 
158
- option ['-y', '--assumeyes'], :flag,
159
- 'Automatically answer yes for all questions' do |assume|
160
- ForemanMaintain.reporter.assumeyes = assume
159
+ if opts.include?('assumeyes')
160
+ option ['-y', '--assumeyes'], :flag,
161
+ 'Automatically answer yes for all questions' do |assume|
162
+ ForemanMaintain.reporter.assumeyes = assume
163
+ end
161
164
  end
162
165
 
163
- option(['-w', '--whitelist'], 'whitelist',
164
- 'Comma-separated list of labels of steps to be skipped') do |whitelist|
165
- raise ArgumentError, 'value not specified' if whitelist.nil? || whitelist.empty?
166
- whitelist.split(',').map(&:strip)
166
+ if opts.include?('whitelist')
167
+ option(['-w', '--whitelist'], 'whitelist',
168
+ 'Comma-separated list of labels of steps to be skipped') do |whitelist|
169
+ raise ArgumentError, 'value not specified' if whitelist.nil? || whitelist.empty?
170
+ whitelist.split(',').map(&:strip)
171
+ end
167
172
  end
168
173
 
169
- option ['-f', '--force'], :flag,
170
- 'Force steps that would be skipped as they were already run'
174
+ if opts.include?('force')
175
+ option ['-f', '--force'], :flag,
176
+ 'Force steps that would be skipped as they were already run'
177
+ end
171
178
  end
179
+ # rubocop:enable Metrics/MethodLength
172
180
 
173
181
  def self.service_options
174
182
  option '--exclude', 'EXCLUDE', 'A comma-separated list of services to skip'
@@ -2,28 +2,28 @@ module ForemanMaintain
2
2
  module Cli
3
3
  class PackagesCommand < Base
4
4
  subcommand 'lock', 'Prevent packages from automatic update' do
5
- interactive_option
5
+ interactive_option(['assumeyes'])
6
6
  def execute
7
7
  run_scenarios_and_exit(Scenarios::Packages::Lock.new)
8
8
  end
9
9
  end
10
10
 
11
11
  subcommand 'unlock', 'Enable packages for automatic update' do
12
- interactive_option
12
+ interactive_option(['assumeyes'])
13
13
  def execute
14
14
  run_scenarios_and_exit(Scenarios::Packages::Unlock.new)
15
15
  end
16
16
  end
17
17
 
18
18
  subcommand 'status', 'Check if packages are protected against update' do
19
- interactive_option
19
+ interactive_option(['assumeyes'])
20
20
  def execute
21
21
  run_scenarios_and_exit(Scenarios::Packages::Status.new)
22
22
  end
23
23
  end
24
24
 
25
25
  subcommand 'install', 'Install packages in an unlocked session' do
26
- interactive_option
26
+ interactive_option(['assumeyes'])
27
27
  parameter 'PACKAGES ...', 'packages to install', :attribute_name => :packages
28
28
 
29
29
  def execute
@@ -37,7 +37,7 @@ module ForemanMaintain
37
37
  end
38
38
 
39
39
  subcommand 'update', 'Update packages in an unlocked session' do
40
- interactive_option
40
+ interactive_option(['assumeyes'])
41
41
  parameter '[PACKAGES] ...', 'packages to update', :attribute_name => :packages
42
42
 
43
43
  def execute
@@ -51,7 +51,7 @@ module ForemanMaintain
51
51
  end
52
52
 
53
53
  subcommand 'is-locked', 'Check if update of packages is allowed' do
54
- interactive_option
54
+ interactive_option([])
55
55
  def execute
56
56
  locked = ForemanMaintain.package_manager.versions_locked?
57
57
  puts "Packages are#{locked ? '' : ' not'} locked"
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.8.2'.freeze
2
+ VERSION = '0.8.3'.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.2
4
+ version: 0.8.3
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-06-16 00:00:00.000000000 Z
11
+ date: 2021-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -265,6 +265,7 @@ files:
265
265
  - definitions/procedures/pulp/remove.rb
266
266
  - definitions/procedures/pulpcore/migrate.rb
267
267
  - definitions/procedures/puppet/delete_empty_ca_cert_request_files.rb
268
+ - definitions/procedures/refresh_features.rb
268
269
  - definitions/procedures/remote_execution/remove_existing_settingsd.rb
269
270
  - definitions/procedures/repositories/disable.rb
270
271
  - definitions/procedures/repositories/setup.rb