beaker-puppet 1.26.0 → 1.26.3

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: 4d82a5d6c99272e6528c5300c892bba44d860797359dd6c7783478154e3d0de7
4
- data.tar.gz: 9e9a836a635b02fafe2892728ac229c24d62deacda562709a6b938c67ccd9f11
3
+ metadata.gz: 1ddf260f1365a694a4791a21c2cd092060761522580f8593d60270b66962f162
4
+ data.tar.gz: b84a11230d1299429b675867da24eb6c7f7a149ea57bb2bb4fca90c1d334e9a1
5
5
  SHA512:
6
- metadata.gz: 96d997b09ccb8c865efa30064fe848bcf1b8c52248f84b29276bd1b27a0be12858473b9e2e9365d995a945783d54cab9cffc0670d8bcde4ce5897b0d5afa9100
7
- data.tar.gz: 809a6331f440fc9d9513ef9b0f8a721dbbf00b036e0f8a409296ff47d49b4a40be205da56e822227844d12d92e644a6b8969943d0f529578987a5e3f8456305b
6
+ metadata.gz: d049d0a4e1f359bee3603a04ecc614eaa305ab267015563f1f4778dde61f1039c9ee806488bfb16bb51eda637b1636e1a5e69464a6cb7529c3ab62f4423f49aa
7
+ data.tar.gz: 15d54d265e21079dec535f764dff3583eb29b16933d3e9f20b35b73fda29f45660fdeb7804680423bbe5c24eba30c2474be0eef77f2e08da6a7a461af3137626
data/CHANGELOG.md CHANGED
@@ -2,16 +2,42 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [1.26.0](https://github.com/voxpupuli/beaker-puppet/tree/1.26.0) (2022-03-23)
5
+ ## [1.26.3](https://github.com/voxpupuli/beaker-puppet/tree/1.26.3) (2022-07-27)
6
6
 
7
- [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.25.0...1.26.0)
7
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.2...1.26.3)
8
+
9
+ **Fixed bugs:**
10
+
11
+ - Actually print the versions.txt file [\#193](https://github.com/voxpupuli/beaker-puppet/pull/193) ([joshcooper](https://github.com/joshcooper))
12
+
13
+ ## [1.26.2](https://github.com/voxpupuli/beaker-puppet/tree/1.26.2) (2022-05-31)
14
+
15
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.1...1.26.2)
16
+
17
+ **Merged pull requests:**
18
+
19
+ - \(PA-4178\) Only clear and add non-default gem sources [\#190](https://github.com/voxpupuli/beaker-puppet/pull/190) ([joshcooper](https://github.com/joshcooper))
20
+
21
+ ## [1.26.1](https://github.com/voxpupuli/beaker-puppet/tree/1.26.1) (2022-03-24)
22
+
23
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.0...1.26.1)
8
24
 
9
25
  **Implemented enhancements:**
10
26
 
11
27
  - \(maint\) Adds CA to Solaris 11 SPARC setup [\#186](https://github.com/voxpupuli/beaker-puppet/pull/186) ([mhashizume](https://github.com/mhashizume))
12
28
 
29
+ **Fixed bugs:**
30
+
31
+ - \(maint\) Fixes Solaris cert setup step [\#188](https://github.com/voxpupuli/beaker-puppet/pull/188) ([mhashizume](https://github.com/mhashizume))
32
+
33
+ **Merged pull requests:**
34
+
13
35
  - \(PA-4332\) Changes download links to HTTPS [\#185](https://github.com/voxpupuli/beaker-puppet/pull/185) ([mhashizume](https://github.com/mhashizume))
14
36
 
37
+ ## [1.26.0](https://github.com/voxpupuli/beaker-puppet/tree/1.26.0) (2022-03-23)
38
+
39
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.25.0...1.26.0)
40
+
15
41
  ## [1.25.0](https://github.com/voxpupuli/beaker-puppet/tree/1.25.0) (2022-03-16)
16
42
 
17
43
  [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.24.0...1.25.0)
@@ -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.0'
2
+ VERSION = '1.26.3'
3
3
  end
@@ -71,6 +71,7 @@ Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
71
71
  EOM
72
72
 
73
73
  hosts.each do |host|
74
+ next unless host.platform =~ /solaris-11(\.2)?-(i386|sparc)/
74
75
  create_remote_file(host, "DigiCertTrustedRootG4.crt.pem", DigiCert)
75
76
  on(host, 'chmod a+r /root/DigiCertTrustedRootG4.crt.pem')
76
77
  on(host, 'cp -p /root/DigiCertTrustedRootG4.crt.pem /etc/certs/CA/')
@@ -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
 
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.0
4
+ version: 1.26.3
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-23 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
271
  requirements: []
272
- rubygems_version: 3.2.32
272
+ rubygems_version: 3.2.33
273
273
  signing_key:
274
274
  specification_version: 4
275
275
  summary: Beaker's Puppet DSL Extension Helpers!