beaker 1.11.2 → 1.12.0

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzdiZWJkMDg4NTUxZmY5NGYyYTczYjU3MGE2MThlZjU5ZmFiN2JmZQ==
4
+ NWYzNDNkZGNiOTY2ZTlkYTFmNWMwM2ZmYTU2ZTVkYTc4Nzg2MmM0ZA==
5
5
  data.tar.gz: !binary |-
6
- MTgzYTI4YzdmOTFjNmVjMDIzYWJmODkxOWUxMTVhYjczNjY5MzU3Mg==
6
+ NTg2ODk5ZjczMzM0ZWQzZTk4YzM2ZGZmODYyOGJmOTE4YmRiNmEzZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTJjZTg2NmU3OTY3MTVlNzIzNGE4NTA2YjU3ZmY2OTlhYTg5Yjk2NDkyMTc1
10
- YzNlMDE3ZmNlNGUyZTNlYWJjOGQ5YTg5YTJiMzNmYzBiOTBiYjA4OTYxNzJl
11
- YWFmNGM0OWNjNTI1YzJhZDA1MWMwNjYwN2Y1NGE2ZjBkZDdiNTA=
9
+ ZDU3MDhmZTdjZDYxMGQ5MmIyZDdmMWQ5ZDc2MWE5OGJlNmNkODEwM2NkM2Q1
10
+ NWJlNjg4NDM3MzMwZGI4OTQ4MmZlZjBlM2M1MjE3NjAyMjA4ZDM0OTM5MTMy
11
+ ZTQ5OGZjNmU2YTdiMzI2OTlmMmNiMGY4NWI4YmM2NGQ2ZWQ2YWU=
12
12
  data.tar.gz: !binary |-
13
- ZjBlMjU0M2FjZDRmMmIxN2U5ZDYxNmVkZWU3MzA1Njk2ZDBkYjFhOGRhNWM4
14
- YWY3Njg3ZjEwNTAzMGViNzFjYzY4ZTlkNDYxYjVmYzg5MzkxNDhkYWIwNjlj
15
- YTNlZWJlNGYwNWUxYmM3ODA4ZWFiYWMzYWI3ZGVkMTJkZDU5MTU=
13
+ NWViYmEzMmE5OGQxZGNkZGMzODllOWRjN2ZmNGJmMjcwOTZiOThhYTVkNDE4
14
+ NTI4NzUxZGRhZmUzOGQ2MDYwMDQ4NWI0OTg0Y2EyZDY2YTUyYmYzMTk4MWYy
15
+ MGY1MTBhOWFmY2QwMDVkM2QyMTdmZTRmODU5N2MxNjA3MmFhYmM=
@@ -926,7 +926,13 @@ module Beaker
926
926
  # that if the script doesn't exist, we should just use `pe-puppet`
927
927
  result = on agent, "[ -e /etc/init.d/pe-puppet-agent ]", :acceptable_exit_codes => [0,1]
928
928
  agent_service = (result.exit_code == 0) ? 'pe-puppet-agent' : 'pe-puppet'
929
- on agent, puppet_resource('service', agent_service, 'ensure=stopped')
929
+ if agent['platform'] =~ /el-4/
930
+ # On EL4, the init script does not work correctly with
931
+ # 'puppet resource service'
932
+ on agent, "/etc/init.d/#{agent_service} stop"
933
+ else
934
+ on agent, puppet_resource('service', agent_service, 'ensure=stopped')
935
+ end
930
936
  end
931
937
 
932
938
  #stops the puppet agent running on the default host
@@ -149,10 +149,14 @@ module Beaker
149
149
  # on host, "#{installer_cmd(host, opts)} -a #{host['working_dir']}/answers"
150
150
  # @api private
151
151
  def installer_cmd(host, opts)
152
- version = opts[:pe_ver] || host['pe_ver']
152
+ version = host['pe_ver'] || opts[:pe_ver]
153
153
  if host['platform'] =~ /windows/
154
154
  version = opts[:pe_ver_win] || host['pe_ver']
155
155
  "cd #{host['working_dir']} && cmd /C 'start /w msiexec.exe /qn /i puppet-enterprise-#{version}.msi PUPPET_MASTER_SERVER=#{master} PUPPET_AGENT_CERTNAME=#{host}'"
156
+ elsif host['platform'] =~ /osx/
157
+ version = host['pe_ver'] || opts[:pe_ver]
158
+ "cd #{host['working_dir']} && hdiutil attach #{host['dist']}.dmg && installer -pkg /Volumes/puppet-enterprise-#{version}/puppet-enterprise-installer-#{version}.pkg -target /"
159
+
156
160
  # Frictionless install didn't exist pre-3.2.0, so in that case we fall
157
161
  # through and do a regular install.
158
162
  elsif host['roles'].include? 'frictionless' and ! version_is_less(version, '3.2.0')
@@ -180,15 +184,39 @@ module Beaker
180
184
  end
181
185
  end
182
186
 
187
+ #Determine the PE package to download/upload on a mac host, download/upload that package onto the host.
188
+ # Assumed file name format: puppet-enterprise-3.3.0-rc1-559-g97f0833-osx-10.9-x86_64.dmg.
189
+ # @param [Host] host The mac host to download/upload and unpack PE onto
190
+ # @param [Hash{Symbol=>Symbol, String}] opts The options
191
+ # @option opts [String] :pe_dir Default directory or URL to pull PE package from
192
+ # (Otherwise uses individual hosts pe_dir)
193
+ # @api private
194
+ def fetch_puppet_on_mac(host, opts)
195
+ path = host['pe_dir'] || opts[:pe_dir]
196
+ local = File.directory?(path)
197
+ filename = "#{host['dist']}"
198
+ extension = ".dmg"
199
+ if local
200
+ if not File.exists?("#{path}/#{filename}#{extension}")
201
+ raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
202
+ end
203
+ scp_to host, "#{path}/#{filename}#{extension}", "#{host['working_dir']}/#{filename}#{extension}"
204
+ else
205
+ if not link_exists?("#{path}/#{filename}#{extension}")
206
+ raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
207
+ end
208
+ on host, "cd #{host['working_dir']}; curl -O #{path}/#{filename}#{extension}"
209
+ end
210
+ end
211
+
183
212
  #Determine the PE package to download/upload on a windows host, download/upload that package onto the host.
213
+ #Assumed file name format: puppet-enterprise-3.3.0-rc1-559-g97f0833.msi
184
214
  # @param [Host] host The windows host to download/upload and unpack PE onto
185
215
  # @param [Hash{Symbol=>Symbol, String}] opts The options
186
216
  # @option opts [String] :pe_dir Default directory or URL to pull PE package from
187
217
  # (Otherwise uses individual hosts pe_dir)
188
- # @option opts [String] :pe_ver Default PE version to install or upgrade to
218
+ # @option opts [String] :pe_ver_win Default PE version to install or upgrade to
189
219
  # (Otherwise uses individual hosts pe_ver)
190
- # @option opts [String] :pe_ver_win Default PE version to install or upgrade to on Windows hosts
191
- # (Otherwise uses individual Windows hosts pe_ver)
192
220
  # @api private
193
221
  def fetch_puppet_on_windows(host, opts)
194
222
  path = host['pe_dir'] || opts[:pe_dir]
@@ -215,8 +243,6 @@ module Beaker
215
243
  # @param [Hash{Symbol=>Symbol, String}] opts The options
216
244
  # @option opts [String] :pe_dir Default directory or URL to pull PE package from
217
245
  # (Otherwise uses individual hosts pe_dir)
218
- # @option opts [String] :pe_ver Default PE version to install or upgrade to
219
- # (Otherwise uses individual hosts pe_ver)
220
246
  # @api private
221
247
  def fetch_puppet_on_unix(host, opts)
222
248
  path = host['pe_dir'] || opts[:pe_dir]
@@ -262,9 +288,10 @@ module Beaker
262
288
  # We install Puppet from the master for frictionless installs, so we don't need to *fetch* anything
263
289
  next if host['roles'].include? 'frictionless' and ! version_is_less(opts[:pe_ver] || host['pe_ver'], '3.2.0')
264
290
 
265
- windows = host['platform'] =~ /windows/
266
- if windows
291
+ if host['platform'] =~ /windows/
267
292
  fetch_puppet_on_windows(host, opts)
293
+ elsif host['platform'] =~ /osx/
294
+ fetch_puppet_on_mac(host, opts)
268
295
  else
269
296
  fetch_puppet_on_unix(host, opts)
270
297
  end
@@ -311,10 +338,13 @@ module Beaker
311
338
  use_all_tar = ENV['PE_USE_ALL_TAR'] == 'true'
312
339
  hosts.each do |host|
313
340
  host['pe_installer'] ||= 'puppet-enterprise-installer'
314
- if host['platform'] !~ /windows/
341
+ if host['platform'] !~ /windows|osx/
315
342
  platform = use_all_tar ? 'all' : host['platform']
316
343
  version = host['pe_ver'] || opts[:pe_ver]
317
344
  host['dist'] = "puppet-enterprise-#{version}-#{platform}"
345
+ elsif host['platform'] =~ /osx/
346
+ version = host['pe_ver'] || opts[:pe_ver]
347
+ host['dist'] = "puppet-enterprise-#{version}-#{host['platform']}"
318
348
  end
319
349
  host['working_dir'] = "/tmp/" + Time.new.strftime("%Y-%m-%d_%H.%M.%S") #unique working dirs make me happy
320
350
  on host, "mkdir #{host['working_dir']}"
@@ -327,6 +357,13 @@ module Beaker
327
357
  next if host == database and host != master and host != dashboard and pre30database
328
358
  if host['platform'] =~ /windows/
329
359
  on host, installer_cmd(host, opts)
360
+ elsif host['platform'] =~ /osx/
361
+ on host, installer_cmd(host, opts)
362
+ #set the certname and master
363
+ on host, puppet("config set server #{master}")
364
+ on host, puppet("config set certname #{host}")
365
+ #run once to request cert
366
+ on host, puppet_agent('-t'), :acceptable_exit_codes => [1]
330
367
  else
331
368
  # We only need answers if we're using the classic installer
332
369
  version = host['pe_ver'] || opts[:pe_ver]
@@ -343,7 +380,6 @@ module Beaker
343
380
  end
344
381
  end
345
382
 
346
-
347
383
  # If we're installing a database version less than 3.0, ignore the database host
348
384
  install_hosts = hosts.dup
349
385
  install_hosts.delete(database) if pre30database and database != master and database != dashboard
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '1.11.2'
3
+ STRING = '1.12.0'
4
4
  end
5
5
  end
@@ -12,11 +12,15 @@ describe ClassMixedWithDSLInstallUtils do
12
12
  :platform => 'linux',
13
13
  :roles => [ 'agent' ] } ) }
14
14
  let(:hosts) { basic_hosts[0][:roles] = ['master', 'database', 'dashboard']
15
- basic_hosts[1][:platform] = 'windows'
16
- basic_hosts }
15
+ basic_hosts[1][:platform] = 'windows'
16
+ basic_hosts[2][:platform] = 'osx-10.9-x86_64'
17
+ basic_hosts }
17
18
  let(:winhost) { make_host( 'winhost', { :platform => 'windows',
18
19
  :pe_ver => '3.0',
19
20
  :working_dir => '/tmp' } ) }
21
+ let(:machost) { make_host( 'machost', { :platform => 'osx-10.9-x86_64',
22
+ :pe_ver => '3.0',
23
+ :working_dir => '/tmp' } ) }
20
24
  let(:unixhost) { make_host( 'unixhost', { :platform => 'linux',
21
25
  :pe_ver => '3.0',
22
26
  :working_dir => '/tmp',
@@ -93,7 +97,7 @@ describe ClassMixedWithDSLInstallUtils do
93
97
 
94
98
  it 'leaves correctly ordered hosts alone' do
95
99
  subject.stub( :hosts ).and_return( hosts )
96
- expect( subject.sorted_hosts ).to be === hosts
100
+ expect( subject.sorted_hosts ).to be === hosts
97
101
  end
98
102
  end
99
103
 
@@ -136,6 +140,12 @@ describe ClassMixedWithDSLInstallUtils do
136
140
  the_host['pe_installer'] = 'puppet-enterprise-installer'
137
141
  expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp/puppet-enterprise-3.1.0-rc0-230-g36c9e5c-debian-7-i386 && ./puppet-enterprise-installer -a /tmp/answers"
138
142
  end
143
+
144
+ it 'generates a osx PE install command for a osx host' do
145
+ the_host = machost.dup
146
+ the_host['pe_installer'] = 'puppet-enterprise-installer'
147
+ expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp && hdiutil attach .dmg && installer -pkg /Volumes/puppet-enterprise-3.0/puppet-enterprise-installer-3.0.pkg -target /"
148
+ end
139
149
  end
140
150
 
141
151
  describe 'fetch_puppet' do
@@ -161,7 +171,7 @@ describe ClassMixedWithDSLInstallUtils do
161
171
  subject.stub( :link_exists? ) do |arg|
162
172
  if arg =~ /.tar.gz/ #there is no .tar.gz link, only a .tar
163
173
  false
164
- else
174
+ else
165
175
  true
166
176
  end
167
177
  end
@@ -186,7 +196,7 @@ describe ClassMixedWithDSLInstallUtils do
186
196
  subject.should_receive( :on ).with( unixhost, "cd #{ unixhost['working_dir'] }; curl #{ path }/#{ filename }#{ extension } | gunzip | tar -xvf -" ).once
187
197
  subject.fetch_puppet( [unixhost], {} )
188
198
  end
189
-
199
+
190
200
  it 'can push a local PE package to a windows host' do
191
201
  File.stub( :directory? ).and_return( true ) #is local
192
202
  File.stub( :exists? ).and_return( true ) #is present
@@ -201,6 +211,32 @@ describe ClassMixedWithDSLInstallUtils do
201
211
 
202
212
  end
203
213
 
214
+ it 'can download a PE dmg from a URL to a mac host' do
215
+ File.stub( :directory? ).and_return( false ) #is not local
216
+ machost['pe_dir'] = 'http://www.path.com/dir/'
217
+ subject.stub( :link_exists? ).and_return( true ) #is not local
218
+ subject.stub( :on ).and_return( true )
219
+
220
+ path = machost['pe_dir']
221
+ filename = "#{ machost['dist'] }"
222
+ extension = '.dmg'
223
+ subject.should_receive( :on ).with( machost, "cd #{ machost['working_dir'] }; curl -O #{ path }/#{ filename }#{ extension }" ).once
224
+ subject.fetch_puppet( [machost], {} )
225
+ end
226
+
227
+ it 'can push a PE dmg to a mac host' do
228
+ File.stub( :directory? ).and_return( true ) #is local
229
+ machost['pe_dir'] = 'http://www.path.com/dir/'
230
+ File.stub( :exists? ).and_return( true ) #is present
231
+ subject.stub( :scp_to ).and_return( true )
232
+
233
+ path = machost['pe_dir']
234
+ filename = "#{ machost['dist'] }"
235
+ extension = '.dmg'
236
+ subject.should_receive( :scp_to ).with( machost, "#{ path }/#{ filename }#{ extension }", "#{ machost['working_dir'] }/#{ filename }#{ extension }" ).once
237
+ subject.fetch_puppet( [machost], {} )
238
+ end
239
+
204
240
  it "does nothing for a frictionless agent for PE >= 3.2.0" do
205
241
  unixhost['roles'] << 'frictionless'
206
242
  unixhost['pe_ver'] = '3.2.0'
@@ -220,7 +256,12 @@ describe ClassMixedWithDSLInstallUtils do
220
256
  subject.stub( :stop_agent_on ).and_return( true )
221
257
  subject.stub( :sleep_until_puppetdb_started ).and_return( true )
222
258
  subject.stub( :wait_for_host_in_dashboard ).and_return( true )
223
- subject.stub( :puppet_agent ).and_return( "puppet agent" )
259
+ subject.stub( :puppet_agent ).and_return do |arg|
260
+ "puppet agent #{arg}"
261
+ end
262
+ subject.stub( :puppet ).and_return do |arg|
263
+ "puppet #{arg}"
264
+ end
224
265
 
225
266
  subject.stub( :hosts ).and_return( hosts )
226
267
  #determine mastercert
@@ -231,11 +272,14 @@ describe ClassMixedWithDSLInstallUtils do
231
272
  subject.should_receive( :on ).with( hosts[2], /mkdir/ ).once
232
273
  #create answers file per-host, except windows
233
274
  subject.should_receive( :create_remote_file ).with( hosts[0], /answers/, /q/ ).once
234
- subject.should_receive( :create_remote_file ).with( hosts[2], /answers/, /q/ ).once
235
275
  #run installer on all hosts
236
276
  subject.should_receive( :on ).with( hosts[0], /puppet-enterprise-installer/ ).once
237
277
  subject.should_receive( :on ).with( hosts[1], /msiexec.exe/ ).once
238
- subject.should_receive( :on ).with( hosts[2], /puppet-enterprise-installer/ ).once
278
+ subject.should_receive( :on ).with( hosts[2], / hdiutil attach puppet-enterprise-3.0-osx-10.9-x86_64.dmg && installer -pkg \/Volumes\/puppet-enterprise-3.0\/puppet-enterprise-installer-3.0.pkg -target \// ).once
279
+ #does extra mac specific commands
280
+ subject.should_receive( :on ).with( hosts[2], /puppet config set server/ ).once
281
+ subject.should_receive( :on ).with( hosts[2], /puppet config set certname/ ).once
282
+ subject.should_receive( :on ).with( hosts[2], /puppet agent -t/, :acceptable_exit_codes => [1] ).once
239
283
  #sign certificate per-host
240
284
  subject.should_receive( :sign_certificate_for ).with( hosts[0] ).once
241
285
  subject.should_receive( :sign_certificate_for ).with( hosts[1] ).once
@@ -247,9 +291,9 @@ describe ClassMixedWithDSLInstallUtils do
247
291
  #wait for puppetdb to start
248
292
  subject.should_receive( :sleep_until_puppetdb_started ).with( hosts[0] ).once
249
293
  #run each puppet agent once
250
- subject.should_receive( :on ).with( hosts[0], /puppet agent/, :acceptable_exit_codes => [0,2] ).once
251
- subject.should_receive( :on ).with( hosts[1], /puppet agent/, :acceptable_exit_codes => [0,2] ).once
252
- subject.should_receive( :on ).with( hosts[2], /puppet agent/, :acceptable_exit_codes => [0,2] ).once
294
+ subject.should_receive( :on ).with( hosts[0], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
295
+ subject.should_receive( :on ).with( hosts[1], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
296
+ subject.should_receive( :on ).with( hosts[2], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
253
297
  #run rake task on dashboard
254
298
  subject.should_receive( :on ).with( hosts[0], /\/opt\/puppet\/bin\/rake -sf \/opt\/puppet\/share\/puppet-dashboard\/Rakefile .* RAILS_ENV=production/ ).once
255
299
  #wait for all hosts to appear in the dashboard
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.2
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-16 00:00:00.000000000 Z
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest