beaker-puppet 1.26.2 → 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: ebee2d6dab945dc437d7af314caa7b5667ebe4912d229d311b06868f0f791519
4
- data.tar.gz: 8b34f260a93353ee742c344ff39986e102054884165024ca5a91b82b14616c78
3
+ metadata.gz: 1ddf260f1365a694a4791a21c2cd092060761522580f8593d60270b66962f162
4
+ data.tar.gz: b84a11230d1299429b675867da24eb6c7f7a149ea57bb2bb4fca90c1d334e9a1
5
5
  SHA512:
6
- metadata.gz: 25eb49dfcb68e27cb9d44d57bf439d640a8e29b5173427139f2d18867729ec6a5449d135cec25b7e6ba74aeb804639ddc120f899822253f339abc36b96a61035
7
- data.tar.gz: '03834218105e8e4d38a5b0f9477ab51a1a94925011127ff33b1b1e2ba985dde7543a5ecab2519eee05b96c3724861902e54d6f0def5e927a3b07f5c615d142d3'
6
+ metadata.gz: d049d0a4e1f359bee3603a04ecc614eaa305ab267015563f1f4778dde61f1039c9ee806488bfb16bb51eda637b1636e1a5e69464a6cb7529c3ab62f4423f49aa
7
+ data.tar.gz: 15d54d265e21079dec535f764dff3583eb29b16933d3e9f20b35b73fda29f45660fdeb7804680423bbe5c24eba30c2474be0eef77f2e08da6a7a461af3137626
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.26.3](https://github.com/voxpupuli/beaker-puppet/tree/1.26.3) (2022-07-27)
6
+
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
+
5
13
  ## [1.26.2](https://github.com/voxpupuli/beaker-puppet/tree/1.26.2) (2022-05-31)
6
14
 
7
15
  [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.1...1.26.2)
@@ -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.2'
2
+ VERSION = '1.26.3'
3
3
  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
 
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.2
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-05-31 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