beaker-puppet 1.26.1 → 1.27.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: 7881155eff720047edee385b9d3a8809eb9108a6b4a8e11804921db18aeb9cd5
4
- data.tar.gz: 5b1e5543bd316c178d86ab7c6d7210d72827bf4637d308bba8f536392a2a77cf
3
+ metadata.gz: 68502ef5f5e7277b97ce2192ef1d51f571d084e705e98d69f1f4a53e303fcac0
4
+ data.tar.gz: 3c3c471c33bf0481e6a3d8e44fdaabae4f5efec04377f56a66135d905995c043
5
5
  SHA512:
6
- metadata.gz: e02efc2cebc7153164768360aa56bbe5fed898de6d0ebed8755a4551e53acee14d1c565a4314628cd9e7dd5f544f58dffc09cd29608f8d73c897c5264df9669b
7
- data.tar.gz: 96a4681f9d4b2917c430c912df50a4bf334a28d57fab9648bf13eb9218955fd42f4df3deb601f05c5620ad91f3aaad5603cc786085e6791491e141e6110d74fe
6
+ metadata.gz: 036c6489dd3157d13fb07123dfc27dba5bf7ef1e6ac488f8230942072057a01fd9f32a36922747fc8e656562ffc88f967e0c54f7b4ca15dab9ba4ae6c2ce88dc
7
+ data.tar.gz: bca6b6878ed42eb9126af029381df3144c5c7e540ffafc07031c14d478e34212256ccf56dd4b9972852ef0f894616b7c1ed95e8b2c7a3f31587a223abbad03e5
data/CHANGELOG.md CHANGED
@@ -2,6 +2,38 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.27.0](https://github.com/voxpupuli/beaker-puppet/tree/1.27.0) (2022-08-31)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.3...1.27.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - \(ITSYS-2543\) Adds workaround for EL8 PPCLE [\#198](https://github.com/voxpupuli/beaker-puppet/pull/198) ([mhashizume](https://github.com/mhashizume))
12
+
13
+ **Fixed bugs:**
14
+
15
+ - \(PA-4566\) Retry beaker exec if presuite completes [\#195](https://github.com/voxpupuli/beaker-puppet/pull/195) ([joshcooper](https://github.com/joshcooper))
16
+
17
+ ## [1.26.3](https://github.com/voxpupuli/beaker-puppet/tree/1.26.3) (2022-08-09)
18
+
19
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.2...1.26.3)
20
+
21
+ **Fixed bugs:**
22
+
23
+ - Actually print the versions.txt file [\#193](https://github.com/voxpupuli/beaker-puppet/pull/193) ([joshcooper](https://github.com/joshcooper))
24
+
25
+ **Merged pull requests:**
26
+
27
+ - Release 1.26.3 [\#196](https://github.com/voxpupuli/beaker-puppet/pull/196) ([joshcooper](https://github.com/joshcooper))
28
+
29
+ ## [1.26.2](https://github.com/voxpupuli/beaker-puppet/tree/1.26.2) (2022-05-31)
30
+
31
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.1...1.26.2)
32
+
33
+ **Merged pull requests:**
34
+
35
+ - \(PA-4178\) Only clear and add non-default gem sources [\#190](https://github.com/voxpupuli/beaker-puppet/pull/190) ([joshcooper](https://github.com/joshcooper))
36
+
5
37
  ## [1.26.1](https://github.com/voxpupuli/beaker-puppet/tree/1.26.1) (2022-03-24)
6
38
 
7
39
  [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.0...1.26.1)
@@ -1625,12 +1625,18 @@ module Beaker
1625
1625
  # Configures gem sources on hosts to use a mirror, if specified
1626
1626
  # This is a duplicate of the Gemfile logic.
1627
1627
  def configure_gem_mirror(hosts)
1628
- gem_source = ENV['GEM_SOURCE'] || 'https://rubygems.org'
1629
-
1630
- Array(hosts).each do |host|
1631
- gem = gem_command(host)
1632
- on host, "#{gem} source --clear-all"
1633
- on host, "#{gem} source --add #{gem_source}"
1628
+ gem_source = ENV['GEM_SOURCE']
1629
+
1630
+ # Newer versions of rubygems always default the source to https://rubygems.org
1631
+ # and versions >= 3.1 will try to prompt (and fail) if you add a source that is
1632
+ # too similar to rubygems.org to prevent typo squatting:
1633
+ # https://github.com/rubygems/rubygems/commit/aa967b85dd96bbfb350f104125f23d617e82a00a
1634
+ if gem_source && gem_source !~ /rubygems\.org/
1635
+ Array(hosts).each do |host|
1636
+ gem = gem_command(host)
1637
+ on host, "#{gem} source --clear-all"
1638
+ on(host, "#{gem} source --add #{gem_source}")
1639
+ end
1634
1640
  end
1635
1641
  end
1636
1642
  end
@@ -177,11 +177,13 @@ module Beaker
177
177
  # emit the misc/versions.txt file which contains component versions for
178
178
  # puppet, facter, hiera, pxp-agent, packaging and vendored Ruby
179
179
  [
180
- '"${env:ProgramFiles}/Puppet Labs/puppet/misc/versions.txt"',
181
- '"${env:ProgramFiles(x86)}/Puppet Labs/puppet/misc/versions.txt"'
180
+ "'%PROGRAMFILES%\\Puppet Labs\\puppet\\misc\\versions.txt'",
181
+ "'%PROGRAMFILES(X86)%\\Puppet Labs\\puppet\\misc\\versions.txt'",
182
182
  ].each do |path|
183
- if file_exists_on(host, path)
184
- logger.info(file_contents_on(host, path)) && break
183
+ result = on(host, "cmd /c type #{path}", :accept_all_exit_codes => true)
184
+ if result.exit_code == 0
185
+ logger.info(result.stdout)
186
+ break
185
187
  end
186
188
  end
187
189
  end
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.26.1'
2
+ VERSION = '1.27.0'
3
3
  end
@@ -0,0 +1,10 @@
1
+ test_name 'Refresh Red Hat 8 subscription repository'
2
+
3
+ # Only need to run this on Red Hat Enterprise Linux 8 on little-endian PowerPC
4
+ skip_test 'Not Red Hat 8 PPCle' if ! hosts.any? { |host| host.platform == 'el-8-ppc64le' }
5
+
6
+ hosts.each do |host|
7
+ next unless host.platform == 'el-8-ppc64le'
8
+
9
+ on(host, '/usr/sbin/subscription-manager repos --disable rhel-8-for-ppc64le-baseos-rpms && /usr/sbin/subscription-manager repos --enable rhel-8-for-ppc64le-baseos-rpms')
10
+ end
@@ -153,7 +153,9 @@ describe ClassMixedWithDSLInstallUtils do
153
153
 
154
154
  describe '#puppet_collection_for' do
155
155
  it 'raises an error when given an invalid package' do
156
- expect { subject.puppet_collection_for(:foo, '5.5.4') }.to raise_error
156
+ expect {
157
+ subject.puppet_collection_for(:foo, '5.5.4')
158
+ }.to raise_error(RuntimeError, /package must be one of puppet_agent, puppet, puppetserver/)
157
159
  end
158
160
 
159
161
  context 'when the :puppet_agent package is passed in' do
@@ -26,31 +26,45 @@ describe ClassMixedWithDSLInstallUtils do
26
26
  :is_cygwin => 'false' } ) }
27
27
  let(:hosts) { [ winhost, winhost_non_cygwin ] }
28
28
 
29
- def expect_install_called(times = hosts.length)
30
- result = expect( Beaker::Command ).to receive( :new )
31
- .with( /^"#{batch_path}"$/, [], {:cmdexe => true})
32
- .exactly( times ).times
29
+ def expect_install_called
30
+ result = Beaker::Result.new(nil, 'temp')
31
+ result.exit_code = 0
33
32
 
34
- yield result if block_given?
33
+ hosts.each do |host|
34
+ expectation = expect(subject).to receive(:on).with(host, having_attributes(command: "\"#{batch_path}\""), anything).and_return(result)
35
+ if block_given?
36
+ should_break = yield expectation
37
+ break if should_break
38
+ end
39
+ end
35
40
  end
36
41
 
37
- def expect_status_called(times = hosts.length)
38
- expect( Beaker::Command ).to receive( :new )
39
- .with( "sc qc puppet || sc qc pe-puppet", [], {:cmdexe => true} )
40
- .exactly( times ).times
42
+ def expect_status_called(start_type = 'DEMAND_START')
43
+ result = Beaker::Result.new(nil, 'temp')
44
+ result.exit_code = 0
45
+ result.stdout = case start_type
46
+ when 'DISABLED'
47
+ " START_TYPE : 4 DISABLED"
48
+ when 'AUTOMATIC'
49
+ " START_TYPE : 2 AUTO_START"
50
+ else # 'DEMAND_START'
51
+ " START_TYPE : 3 DEMAND_START"
52
+ end
53
+
54
+ hosts.each do |host|
55
+ expect(subject).to receive(:on).with(host, having_attributes(command: "sc qc puppet || sc qc pe-puppet")).and_yield(result)
56
+ end
41
57
  end
42
58
 
43
59
  def expect_version_log_called(times = hosts.length)
44
- path = %{"${env:ProgramFiles}/Puppet Labs/puppet/misc/versions.txt"}
60
+ path = "'%PROGRAMFILES%\\Puppet Labs\\puppet\\misc\\versions.txt'"
45
61
 
46
- expect( subject ).to receive( :file_exists_on )
47
- .with(anything, path)
48
- .exactly( times ).times
49
- .and_return(true)
62
+ result = Beaker::Result.new(nil, 'temp')
63
+ result.exit_code = 0
50
64
 
51
- expect( subject ).to receive( :file_contents_on )
52
- .with(anything, path)
53
- .exactly( times ).times
65
+ hosts.each do |host|
66
+ expect(subject).to receive(:on).with(host, "cmd /c type #{path}", anything).and_return(result)
67
+ end
54
68
  end
55
69
 
56
70
  def expect_script_matches(hosts, contents)
@@ -68,30 +82,43 @@ describe ClassMixedWithDSLInstallUtils do
68
82
  expect(host).to receive(:is_x86_64?).and_return(:true)
69
83
  end
70
84
 
71
- expect( Beaker::Command ).to receive( :new )
72
- .with(%r{reg query "HKLM\\SOFTWARE\\Wow6432Node\\Puppet Labs\\PuppetInstaller}, [], {:cmdexe => true})
73
- .exactly(times).times
85
+ hosts.each do |host|
86
+ expect(subject).to receive(:on)
87
+ .with(host, having_attributes(command: %r{reg query "HKLM\\SOFTWARE\\Wow6432Node\\Puppet Labs\\PuppetInstaller}))
88
+ end
74
89
  end
75
90
 
76
- def expect_puppet_path_called(times = 1)
77
- expect( Beaker::Command ).to receive( :new )
78
- .with( 'puppet -h', [], {:cmdexe => true} )
79
- .exactly( times ).times
91
+ def expect_puppet_path_called
92
+ hosts.each do |host|
93
+ next if host.is_cygwin?
94
+
95
+ result = Beaker::Result.new(nil, 'temp')
96
+ result.exit_code = 0
97
+
98
+ expect(subject).to receive(:on)
99
+ .with(host, having_attributes(command: 'puppet -h'), anything)
100
+ .and_return(result)
101
+ end
80
102
  end
81
103
 
82
104
  describe "#install_msi_on" do
83
105
  let( :log_file ) { '/fake/log/file.log' }
84
106
 
85
107
  before :each do
86
- exit_code_result = Beaker::Result.new(nil, 'temp')
87
- exit_code_result.exit_code = 0
108
+ result = Beaker::Result.new(nil, 'temp')
109
+ result.exit_code = 0
110
+
111
+ hosts.each do |host|
112
+ allow(subject).to receive(:on)
113
+ .with(host, having_attributes(command: "\"#{batch_path}\""))
114
+ .and_return(result)
115
+ end
88
116
 
89
- allow( subject ).to receive( :on ).and_return( exit_code_result )
90
117
  allow( subject ).to receive( :file_exists_on ).and_return(true)
91
118
  allow( subject ).to receive( :create_install_msi_batch_on ).and_return( [batch_path, log_file] )
92
119
  end
93
120
 
94
- it "will specify a PUPPET_AGENT_STARTUP_MODE of Manual (disabling the service) by default" do
121
+ it "will specify a PUPPET_AGENT_STARTUP_MODE of Manual by default" do
95
122
  expect_install_called
96
123
  expect_puppet_path_called
97
124
  expect_status_called
@@ -103,10 +130,10 @@ describe ClassMixedWithDSLInstallUtils do
103
130
  subject.install_msi_on(hosts, msi_path, {})
104
131
  end
105
132
 
106
- it "allows configuration of PUPPET_AGENT_STARTUP_MODE" do
133
+ it "allows configuration of PUPPET_AGENT_STARTUP_MODE to Automatic" do
107
134
  expect_install_called
108
135
  expect_puppet_path_called
109
- expect_status_called
136
+ expect_status_called('AUTOMATIC')
110
137
  expect_reg_query_called
111
138
  expect_version_log_called
112
139
  value = 'Automatic'
@@ -116,6 +143,19 @@ describe ClassMixedWithDSLInstallUtils do
116
143
  subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => value})
117
144
  end
118
145
 
146
+ it "allows configuration of PUPPET_AGENT_STARTUP_MODE to Disabled" do
147
+ expect_install_called
148
+ expect_puppet_path_called
149
+ expect_status_called('DISABLED')
150
+ expect_reg_query_called
151
+ expect_version_log_called
152
+ value = 'Disabled'
153
+ expect( subject ).to receive( :create_install_msi_batch_on ).with(
154
+ anything, anything,
155
+ {'PUPPET_AGENT_STARTUP_MODE' => value})
156
+ subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => value})
157
+ end
158
+
119
159
  it "will not generate a command to emit a log file without the :debug option set" do
120
160
  expect_install_called
121
161
  expect_puppet_path_called
@@ -130,13 +170,15 @@ describe ClassMixedWithDSLInstallUtils do
130
170
 
131
171
  it "will generate a command to emit a log file when the install script fails" do
132
172
  # note a single failure aborts executing against remaining hosts
133
- hosts_affected = 1
134
-
135
- expect_install_called(hosts_affected) { |e| e.and_raise }
136
- expect_status_called(0)
173
+ expect_install_called do |e|
174
+ e.and_raise
175
+ true # break
176
+ end
137
177
 
138
178
  expect( subject ).to receive( :file_contents_on ).with(anything, log_file)
139
- expect { subject.install_msi_on(hosts, msi_path) }.to raise_error(RuntimeError)
179
+ expect {
180
+ subject.install_msi_on(hosts, msi_path)
181
+ }.to raise_error(RuntimeError)
140
182
  end
141
183
 
142
184
  it "will generate a command to emit a log file with the :debug option set" do
@@ -146,7 +188,7 @@ describe ClassMixedWithDSLInstallUtils do
146
188
  expect_status_called
147
189
  expect_version_log_called
148
190
 
149
- expect( subject ).to receive( :file_contents_on ).with(anything, log_file).twice
191
+ expect( subject ).to receive( :file_contents_on ).with(anything, log_file).exactly(hosts.length).times
150
192
 
151
193
  subject.install_msi_on(hosts, msi_path, {}, { :debug => true })
152
194
  end
@@ -171,13 +213,12 @@ describe ClassMixedWithDSLInstallUtils do
171
213
 
172
214
  hosts.each do |host|
173
215
  expect(host).to receive(:is_x86_64?).and_return(true)
174
- end
175
216
 
176
- expect( Beaker::Command ).to receive( :new )
177
- .with('reg query "HKLM\\SOFTWARE\\Wow6432Node\\Puppet Labs\\PuppetInstaller" /v "RememberedPuppetAgentStartupMode" | findstr Foo', [], {:cmdexe => true})
178
- .exactly(hosts.length).times
217
+ expect(subject).to receive(:on)
218
+ .with(host, having_attributes(command: 'reg query "HKLM\\SOFTWARE\\Wow6432Node\\Puppet Labs\\PuppetInstaller" /v "RememberedPuppetAgentStartupMode" | findstr Manual'))
219
+ end
179
220
 
180
- subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => "Foo"})
221
+ subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => "Manual"})
181
222
  end
182
223
 
183
224
  it 'will omit Wow6432Node in the registry search for remembered startup setting on 32-bit hosts' do
@@ -188,13 +229,12 @@ describe ClassMixedWithDSLInstallUtils do
188
229
 
189
230
  hosts.each do |host|
190
231
  expect(host).to receive(:is_x86_64?).and_return(false)
191
- end
192
232
 
193
- expect( Beaker::Command ).to receive( :new )
194
- .with('reg query "HKLM\\SOFTWARE\\Puppet Labs\\PuppetInstaller" /v "RememberedPuppetAgentStartupMode" | findstr Foo', [], {:cmdexe => true})
195
- .exactly(hosts.length).times
233
+ expect(subject).to receive(:on)
234
+ .with(host, having_attributes(command: 'reg query "HKLM\\SOFTWARE\\Puppet Labs\\PuppetInstaller" /v "RememberedPuppetAgentStartupMode" | findstr Manual'))
235
+ end
196
236
 
197
- subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => "Foo"})
237
+ subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => "Manual"})
198
238
  end
199
239
  end
200
240
 
data/tasks/ci.rake CHANGED
@@ -285,17 +285,22 @@ def beaker_suite_retry(type)
285
285
  beaker(:provision)
286
286
 
287
287
  begin
288
- json_results_file = Tempfile.new
289
-
290
288
  beaker(:exec, 'pre-suite', '--preserve-state', '--pre-suite', pre_suites(type))
291
289
  beaker(:exec, 'pre-suite', '--preserve-state')
292
- beaker(:exec, ENV['TESTS'], '--test-results-file', json_results_file.path)
293
- rescue RuntimeError
294
- tests_to_rerun = JSON.load(File.read(json_results_file.path))
295
- if tests_to_rerun.length > 0
296
- puts '*** Retrying the following:'
297
- puts tests_to_rerun.map { |spec| " #{spec}" }
298
- beaker(:exec, tests_to_rerun.map { |str| "#{str}" }.join(',') )
290
+
291
+ begin
292
+ json_results_file = Tempfile.new
293
+ beaker(:exec, ENV['TESTS'], '--test-results-file', json_results_file.path)
294
+ rescue RuntimeError => e
295
+ puts "ERROR: #{e.message}"
296
+ tests_to_rerun = JSON.load(File.read(json_results_file.path))
297
+ if tests_to_rerun.nil? || tests_to_rerun.empty?
298
+ raise e
299
+ else
300
+ puts '*** Retrying the following:'
301
+ puts tests_to_rerun.map { |spec| " #{spec}" }
302
+ beaker(:exec, tests_to_rerun.map { |str| "#{str}" }.join(',') )
303
+ end
299
304
  end
300
305
  ensure
301
306
  beaker(:exec, 'post-suite')
@@ -312,6 +317,7 @@ def pre_suites(type)
312
317
  [
313
318
  "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
314
319
  "#{beaker_root}/setup/common/003_solaris_cert_fix.rb",
320
+ "#{beaker_root}/setup/common/005_redhat_subscription_fix.rb",
315
321
  "#{beaker_root}/setup/aio/010_Install_Puppet_Agent.rb",
316
322
  "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
317
323
  "#{beaker_root}/setup/common/012_Finalize_Installs.rb",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.26.1
4
+ version: 1.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-24 00:00:00.000000000 Z
11
+ date: 2022-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -221,6 +221,7 @@ files:
221
221
  - setup/aio/010_Install_Puppet_Agent.rb
222
222
  - setup/common/000-delete-puppet-when-none.rb
223
223
  - setup/common/003_solaris_cert_fix.rb
224
+ - setup/common/005_redhat_subscription_fix.rb
224
225
  - setup/common/011_Install_Puppet_Server.rb
225
226
  - setup/common/012_Finalize_Installs.rb
226
227
  - setup/common/020_InstallCumulusModules.rb
@@ -269,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
270
  - !ruby/object:Gem::Version
270
271
  version: '0'
271
272
  requirements: []
272
- rubygems_version: 3.2.32
273
+ rubygems_version: 3.2.33
273
274
  signing_key:
274
275
  specification_version: 4
275
276
  summary: Beaker's Puppet DSL Extension Helpers!