beaker-puppet 1.18.13 → 1.18.14

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: 16fa6b2a09e5b987520d65351e9dd34ede8494a3995ea103468118c3cf1ff269
4
- data.tar.gz: 3e0631f16d941336d5247d7caaa4cf861fcc1d860544df109dbc3eae442d16e0
3
+ metadata.gz: 3b61d545a1c2daedf8db34d1022483acc0ccd04632bb0bee75dc31b944e7fd3e
4
+ data.tar.gz: 188fe64c83a71c7b7993990c66f6da3c9533925a69ba5c94254808f02709b8e5
5
5
  SHA512:
6
- metadata.gz: 3ee81de0a0526bf05c1546f6b07db7ccf049fd13efa504baefd64ac53b9bb52485c1ce6b431bd143421b080266748a036d8f3147d1b8958d7661a0580839a4df
7
- data.tar.gz: a8bdb1c26c35d6175bf7bfd8d86761df28828a1eb25dd716b1c2330d6a3af7f9b064bb6a0c360cd2e08fddf6577a37c2a95e2abfb961b5361640cae462c56cdc
6
+ metadata.gz: ec8bcf9a562252bf3ea35d721399e3b96d4811bfba3a060100af5300bef787af7ca0fce736c0aa8e4a3d9d67901ee7b4ace4957cfa9d321a8227fa9d84a39f83
7
+ data.tar.gz: 62fe04f6113bd92d51215a40cca5bc4433411ab421366c70e532e380983064d1d4b2666771e099893cb3e4dcc206acf64ad557fdd3e8f8f02c09c4e3ac10303c
data/Gemfile CHANGED
@@ -16,7 +16,7 @@ end
16
16
 
17
17
 
18
18
  group :test do
19
- gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0')
19
+ gem "beaker", *location_for(ENV['BEAKER_VERSION'] || ['>= 4.16.0', '< 5.0.0'])
20
20
  gem "beaker-abs", *location_for(ENV['ABS_VERSION'] || '~> 0.4.0')
21
21
  end
22
22
 
@@ -692,9 +692,8 @@ module Beaker
692
692
  install_msi_on(host, msi_download_path, {}, opts)
693
693
 
694
694
  configure_type_defaults_on( host )
695
- if not host.is_cygwin?
696
- host.mkdir_p host['distmoduledir']
697
- end
695
+
696
+ host.mkdir_p host['distmoduledir'] unless host.is_cygwin?
698
697
  end
699
698
  end
700
699
 
@@ -32,9 +32,9 @@ module Beaker
32
32
 
33
33
  # msiexec requires quotes around paths with backslashes - c:\ or file://c:\
34
34
  # not strictly needed for http:// but it simplifies this code
35
- batch_contents = <<-BATCH
36
- start /w msiexec.exe /i \"#{msi_path}\" /qn /L*V #{log_path} #{msi_params}
37
- exit /B %errorlevel%
35
+ batch_contents = <<~BATCH
36
+ start /w msiexec.exe /i \"#{msi_path}\" /qn /L*V #{log_path} #{msi_params}
37
+ exit /B %errorlevel%
38
38
  BATCH
39
39
  end
40
40
 
@@ -122,17 +122,22 @@ exit /B %errorlevel%
122
122
  # 3010 = ERROR_SUCCESS_REBOOT_REQUIRED
123
123
  on host, Command.new("\"#{batch_path}\"", [], { :cmdexe => true }), :acceptable_exit_codes => [0, 1641, 3010]
124
124
  rescue
125
- on host, Command.new("type \"#{log_file}\"", [], { :cmdexe => true })
125
+ logger.info(file_contents_on(host, log_file))
126
126
  raise
127
127
  end
128
128
 
129
129
  if opts[:debug]
130
- on host, Command.new("type \"#{log_file}\"", [], { :cmdexe => true })
130
+ logger.info(file_contents_on(host, log_file))
131
131
  end
132
132
 
133
- if !host.is_cygwin?
134
- # HACK: for some reason, post install we need to refresh the connection to make puppet available for execution
133
+ unless host.is_cygwin?
134
+ # Enable the PATH updates
135
135
  host.close
136
+
137
+ # Some systems require a full reboot to trigger the enabled path
138
+ unless on(host, Command.new('puppet -h', [], { :cmdexe => true}), :accept_all_exit_codes => true).exit_code == 0
139
+ host.reboot
140
+ end
136
141
  end
137
142
 
138
143
  # verify service status post install
@@ -170,10 +175,12 @@ exit /B %errorlevel%
170
175
  # emit the misc/versions.txt file which contains component versions for
171
176
  # puppet, facter, hiera, pxp-agent, packaging and vendored Ruby
172
177
  [
173
- "\\\"%ProgramFiles%\\Puppet Labs\\puppet\\misc\\versions.txt\\\"",
174
- "\\\"%ProgramFiles(x86)%\\Puppet Labs\\puppet\\misc\\versions.txt\\\""
178
+ '%ProgramFiles%/Puppet Labs/puppet/misc/versions.txt',
179
+ '%ProgramFiles(x86)%/Puppet Labs/puppet/misc/versions.txt'
175
180
  ].each do |path|
176
- on host, Command.new("\"if exist #{path} type #{path}\"", [], { :cmdexe => true })
181
+ if file_exists_on(host, path)
182
+ logger.info(file_contents_on(host, path)) && break
183
+ end
177
184
  end
178
185
  end
179
186
  end
@@ -201,23 +208,19 @@ exit /B %errorlevel%
201
208
  # 3010 = ERROR_SUCCESS_REBOOT_REQUIRED
202
209
  on host, Command.new("\"#{batch_path}\"", [], { :cmdexe => true }), :acceptable_exit_codes => [0, 1641, 3010]
203
210
  rescue
204
- on host, Command.new("type \"#{log_file}\"", [], { :cmdexe => true })
211
+ logger.info(file_contents_on(host, log_file))
212
+
205
213
  raise
206
214
  end
207
215
 
208
216
  if opts[:debug]
209
- on host, Command.new("type \"#{log_file}\"", [], { :cmdexe => true })
210
- end
211
-
212
- if !host.is_cygwin?
213
- # HACK: for some reason, post install we need to refresh the connection to make puppet available for execution
214
- host.close
217
+ logger.info(file_contents_on(host, log_file))
215
218
  end
216
219
 
220
+ host.close unless host.is_cygwin?
217
221
  end
218
222
  end
219
-
220
223
  end
221
224
  end
222
225
  end
223
- end
226
+ end
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.18.13'
2
+ VERSION = '1.18.14'
3
3
  end
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  describe ClassMixedWithDSLInstallUtils do
14
14
  let(:windows_temp) { 'C:\\Windows\\Temp' }
15
- let( :batch_path ) { '/fake/batch/path' }
15
+ let(:batch_path ) { '/fake/batch/path' }
16
16
  let(:msi_path) { 'c:\\foo\\puppet.msi' }
17
17
  let(:winhost) { make_host( 'winhost',
18
18
  { :platform => Beaker::Platform.new('windows-2008r2-64'),
@@ -41,14 +41,16 @@ describe ClassMixedWithDSLInstallUtils do
41
41
  end
42
42
 
43
43
  def expect_version_log_called(times = hosts.length)
44
- [
45
- "\\\"%ProgramFiles%\\Puppet Labs\\puppet\\misc\\versions.txt\\\"",
46
- "\\\"%ProgramFiles(x86)%\\Puppet Labs\\puppet\\misc\\versions.txt\\\"",
47
- ].each do |path|
48
- expect( Beaker::Command ).to receive( :new )
49
- .with( "\"if exist #{path} type #{path}\"", [], {:cmdexe => true} )
50
- .exactly( times ).times
51
- end
44
+ path = %{%ProgramFiles%/Puppet Labs/puppet/misc/versions.txt}
45
+
46
+ expect( subject ).to receive( :file_exists_on )
47
+ .with(anything, path)
48
+ .exactly( times ).times
49
+ .and_return(true)
50
+
51
+ expect( subject ).to receive( :file_contents_on )
52
+ .with(anything, path)
53
+ .exactly( times ).times
52
54
  end
53
55
 
54
56
  def expect_script_matches(hosts, contents)
@@ -71,15 +73,27 @@ describe ClassMixedWithDSLInstallUtils do
71
73
  .exactly(times).times
72
74
  end
73
75
 
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
80
+ end
81
+
74
82
  describe "#install_msi_on" do
75
83
  let( :log_file ) { '/fake/log/file.log' }
84
+
76
85
  before :each do
77
- allow( subject ).to receive( :on ).and_return( true )
86
+ exit_code_result = Beaker::Result.new(nil, 'temp')
87
+ exit_code_result.exit_code = 0
88
+
89
+ allow( subject ).to receive( :on ).and_return( exit_code_result )
90
+ allow( subject ).to receive( :file_exists_on ).and_return(true)
78
91
  allow( subject ).to receive( :create_install_msi_batch_on ).and_return( [batch_path, log_file] )
79
92
  end
80
93
 
81
94
  it "will specify a PUPPET_AGENT_STARTUP_MODE of Manual (disabling the service) by default" do
82
95
  expect_install_called
96
+ expect_puppet_path_called
83
97
  expect_status_called
84
98
  expect_reg_query_called
85
99
  expect_version_log_called
@@ -91,6 +105,7 @@ describe ClassMixedWithDSLInstallUtils do
91
105
 
92
106
  it "allows configuration of PUPPET_AGENT_STARTUP_MODE" do
93
107
  expect_install_called
108
+ expect_puppet_path_called
94
109
  expect_status_called
95
110
  expect_reg_query_called
96
111
  expect_version_log_called
@@ -103,8 +118,13 @@ describe ClassMixedWithDSLInstallUtils do
103
118
 
104
119
  it "will not generate a command to emit a log file without the :debug option set" do
105
120
  expect_install_called
121
+ expect_puppet_path_called
106
122
  expect_status_called
107
- expect( Beaker::Command ).not_to receive( :new ).with( /^type .*\.log$/, [], {:cmdexe => true} )
123
+ expect_reg_query_called
124
+ expect_version_log_called
125
+
126
+ expect( subject ).to receive( :file_contents_on ).with(anything, log_file).never
127
+
108
128
  subject.install_msi_on(hosts, msi_path)
109
129
  end
110
130
 
@@ -115,23 +135,26 @@ describe ClassMixedWithDSLInstallUtils do
115
135
  expect_install_called(hosts_affected) { |e| e.and_raise }
116
136
  expect_status_called(0)
117
137
 
118
- expect( Beaker::Command ).to receive( :new ).with( /^type \".*\.log\"$/, [], {:cmdexe => true} ).exactly( hosts_affected ).times
138
+ expect( subject ).to receive( :file_contents_on ).with(anything, log_file)
119
139
  expect { subject.install_msi_on(hosts, msi_path) }.to raise_error(RuntimeError)
120
140
  end
121
141
 
122
142
  it "will generate a command to emit a log file with the :debug option set" do
123
143
  expect_install_called
124
144
  expect_reg_query_called
145
+ expect_puppet_path_called
125
146
  expect_status_called
126
147
  expect_version_log_called
127
148
 
128
- expect( Beaker::Command ).to receive( :new ).with( /^type \".*\.log\"$/, [], {:cmdexe => true} ).exactly( hosts.length ).times
149
+ expect( subject ).to receive( :file_contents_on ).with(anything, log_file).twice
150
+
129
151
  subject.install_msi_on(hosts, msi_path, {}, { :debug => true })
130
152
  end
131
153
 
132
154
  it 'will pass msi_path to #create_install_msi_batch_on as-is' do
133
155
  expect_install_called
134
156
  expect_reg_query_called
157
+ expect_puppet_path_called
135
158
  expect_status_called
136
159
  expect_version_log_called
137
160
  test_path = 'test/path'
@@ -142,6 +165,7 @@ describe ClassMixedWithDSLInstallUtils do
142
165
 
143
166
  it 'will search in Wow6432Node for the remembered startup setting on 64-bit hosts' do
144
167
  expect_install_called
168
+ expect_puppet_path_called
145
169
  expect_status_called
146
170
  expect_version_log_called
147
171
 
@@ -158,6 +182,7 @@ describe ClassMixedWithDSLInstallUtils do
158
182
 
159
183
  it 'will omit Wow6432Node in the registry search for remembered startup setting on 32-bit hosts' do
160
184
  expect_install_called
185
+ expect_puppet_path_called
161
186
  expect_status_called
162
187
  expect_version_log_called
163
188
 
@@ -260,4 +285,4 @@ describe ClassMixedWithDSLInstallUtils do
260
285
  end
261
286
  end
262
287
  end
263
- end
288
+ end
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.18.13
4
+ version: 1.18.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-07 00:00:00.000000000 Z
11
+ date: 2020-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec