beaker 2.5.1 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +8 -8
  2. data/HISTORY.md +184 -2
  3. data/acceptance/fixtures/README.md +3 -0
  4. data/acceptance/fixtures/module/Gemfile +12 -0
  5. data/acceptance/fixtures/module/README.md +79 -0
  6. data/acceptance/fixtures/module/Rakefile +18 -0
  7. data/acceptance/fixtures/module/lib/empty.txt +1 -0
  8. data/acceptance/fixtures/module/manifests/init.pp +41 -0
  9. data/acceptance/fixtures/module/metadata.json +14 -0
  10. data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +72 -0
  11. data/acceptance/fixtures/module/spec/acceptance/nodesets/centos-59-x64.yml +10 -0
  12. data/acceptance/fixtures/module/spec/acceptance/nodesets/centos-64-x64-pe.yml +12 -0
  13. data/acceptance/fixtures/module/spec/acceptance/nodesets/centos-64-x64.yml +10 -0
  14. data/acceptance/fixtures/module/spec/acceptance/nodesets/centos-65-x64.yml +10 -0
  15. data/acceptance/fixtures/module/spec/acceptance/nodesets/default.yml +10 -0
  16. data/acceptance/fixtures/module/spec/acceptance/nodesets/fedora-18-x64.yml +10 -0
  17. data/acceptance/fixtures/module/spec/acceptance/nodesets/internal-vpool.yml +17 -0
  18. data/acceptance/fixtures/module/spec/acceptance/nodesets/sles-11-x64.yml +10 -0
  19. data/acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +10 -0
  20. data/acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +10 -0
  21. data/acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +11 -0
  22. data/acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-14042-x64.yml +16 -0
  23. data/acceptance/fixtures/module/spec/classes/init_spec.rb +7 -0
  24. data/acceptance/fixtures/module/spec/spec_helper.rb +1 -0
  25. data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +38 -0
  26. data/acceptance/fixtures/module/tests/init.pp +12 -0
  27. data/acceptance/fixtures/module/vendor/bundle/ruby/gems.txt +1 -0
  28. data/acceptance/pre_suite/README.md +7 -0
  29. data/acceptance/tests/base/README.md +4 -0
  30. data/acceptance/tests/base/host.rb +154 -0
  31. data/acceptance/tests/puppet/README.md +3 -0
  32. data/lib/beaker/answers/version20.rb +1 -1
  33. data/lib/beaker/answers/version28.rb +1 -1
  34. data/lib/beaker/answers/version30.rb +1 -1
  35. data/lib/beaker/dsl/helpers.rb +12 -2
  36. data/lib/beaker/dsl/install_utils.rb +16 -6
  37. data/lib/beaker/host.rb +79 -13
  38. data/lib/beaker/host/pswindows/exec.rb +4 -0
  39. data/lib/beaker/host/unix.rb +3 -12
  40. data/lib/beaker/host/windows.rb +2 -11
  41. data/lib/beaker/host/windows/file.rb +1 -1
  42. data/lib/beaker/host/windows/pkg.rb +1 -1
  43. data/lib/beaker/host_prebuilt_steps.rb +1 -1
  44. data/lib/beaker/hypervisor.rb +4 -2
  45. data/lib/beaker/hypervisor/{vcloud_pooled.rb → vmpooler.rb} +10 -14
  46. data/lib/beaker/options/presets.rb +1 -0
  47. data/lib/beaker/version.rb +1 -1
  48. data/spec/beaker/dsl/helpers_spec.rb +16 -0
  49. data/spec/beaker/dsl/install_utils_spec.rb +7 -6
  50. data/spec/beaker/host_spec.rb +13 -11
  51. data/spec/beaker/hypervisor/hypervisor_spec.rb +2 -2
  52. data/spec/beaker/hypervisor/{vcloud_pooled_spec.rb → vmpooler_spec.rb} +20 -20
  53. metadata +33 -4
@@ -709,7 +709,7 @@ module Beaker
709
709
  end
710
710
 
711
711
  # Certain install paths may not create the config dirs/files needed
712
- on host, "mkdir -p #{host['puppetpath']}"
712
+ on host, "mkdir -p #{host['puppetpath']}" unless host[:type] =~ /aio/
713
713
  on host, "echo '' >> #{host.puppet['hiera_config']}"
714
714
  end
715
715
  nil
@@ -770,7 +770,7 @@ module Beaker
770
770
  # @return nil
771
771
  def configure_puppet_on(host, opts = {})
772
772
  if host['platform'] =~ /windows/
773
- puppet_conf = "#{host['puppetpath']}\\puppet.conf"
773
+ puppet_conf = host.puppet['config']
774
774
  conf_data = ''
775
775
  opts.each do |section,options|
776
776
  conf_data << "[#{section}]`n"
@@ -781,7 +781,7 @@ module Beaker
781
781
  end
782
782
  on host, powershell("\$text = \\\"#{conf_data}\\\"; Set-Content -path '#{puppet_conf}' -value \$text")
783
783
  else
784
- puppet_conf = "#{host['puppetpath']}/puppet.conf"
784
+ puppet_conf = host.puppet['config']
785
785
  conf_data = ''
786
786
  opts.each do |section,options|
787
787
  conf_data << "[#{section}]\n"
@@ -1426,17 +1426,27 @@ module Beaker
1426
1426
  :ignore_list => PUPPET_MODULE_INSTALL_IGNORE}.merge(opts)
1427
1427
  ignore_list = build_ignore_list(opts)
1428
1428
  target_module_dir = on( host, "echo #{opts[:target_module_path]}" ).stdout.chomp
1429
- source = File.expand_path( opts[:source] )
1429
+ source_path = File.expand_path( opts[:source] )
1430
+ source_dir = File.dirname(source_path)
1431
+ source_name = File.basename(source_path)
1430
1432
  if opts.has_key?(:module_name)
1431
1433
  module_name = opts[:module_name]
1432
1434
  else
1433
- _, module_name = parse_for_modulename( source )
1435
+ _, module_name = parse_for_modulename( source_path )
1434
1436
  end
1435
1437
 
1436
1438
  opts[:protocol] ||= 'scp'
1437
1439
  case opts[:protocol]
1438
1440
  when 'scp'
1439
- scp_to host, source, File.join(target_module_dir, module_name), {:ignore => ignore_list}
1441
+ #move to the host
1442
+ scp_to host, source_path, target_module_dir, {:ignore => ignore_list}
1443
+ #rename to the selected module name, if not correct
1444
+ cur_path = File.join(target_module_dir, source_name)
1445
+ new_path = File.join(target_module_dir, module_name)
1446
+ if cur_path != new_path
1447
+ # NOTE: this will need to be updated to handle powershell only windows SUTs
1448
+ on host, "mv #{cur_path} #{new_path}"
1449
+ end
1440
1450
  when 'rsync'
1441
1451
  rsync_to host, source, File.join(target_module_dir, module_name), {:ignore => ignore_list}
1442
1452
  else
data/lib/beaker/host.rb CHANGED
@@ -212,8 +212,13 @@ module Beaker
212
212
  #@return [Boolean] true if x86_64, false otherwise
213
213
  def determine_if_x86_64
214
214
  if is_cygwin?
215
- result = exec(Beaker::Command.new("arch | grep x86_64"), :acceptable_exit_codes => (0...127))
216
- result.exit_code == 0
215
+ if self[:platform] =~ /osx|solaris/
216
+ result = exec(Beaker::Command.new("uname -a | grep x86_64"), :acceptable_exit_codes => (0...127))
217
+ result.exit_code == 0
218
+ else
219
+ result = exec(Beaker::Command.new("arch | grep x86_64"), :acceptable_exit_codes => (0...127))
220
+ result.exit_code == 0
221
+ end
217
222
  else
218
223
  result = exec(Beaker::Command.new("wmic os get osarchitecture"), :acceptable_exit_codes => (0...127))
219
224
  result.stdout =~ /64/
@@ -225,6 +230,29 @@ module Beaker
225
230
  @x86_64 ||= determine_if_x86_64
226
231
  end
227
232
 
233
+ # Converts the provided environment file to a new shell script in /etc/profile.d, then sources that file.
234
+ # This is for sles based hosts.
235
+ # @param [String] env_file The ssh environment file to read from
236
+ def mirror_env_to_profile_d env_file
237
+ if self[:platform] =~ /sles-/
238
+ @logger.debug("mirroring environment to /etc/profile.d on sles platform host")
239
+ cur_env = exec(Beaker::Command.new("cat #{env_file}")).stdout
240
+ shell_env = ''
241
+ cur_env.each_line do |env_line|
242
+ shell_env << "export #{env_line}"
243
+ end
244
+ #here doc it over
245
+ exec(Beaker::Command.new("cat << EOF > #{self[:profile_d_env_file]}\n#{shell_env}EOF"))
246
+ #set permissions
247
+ exec(Beaker::Command.new("chmod +x #{self[:profile_d_env_file]}"))
248
+ #keep it current
249
+ exec(Beaker::Command.new("source #{self[:profile_d_env_file]}"))
250
+ else
251
+ #noop
252
+ @logger.debug("will not mirror environment to /etc/profile.d on non-sles platform host")
253
+ end
254
+ end
255
+
228
256
  #Add the provided key/val to the current ssh environment
229
257
  #@param [String] key The key to add the value to
230
258
  #@param [String] val The value for the key
@@ -236,14 +264,17 @@ module Beaker
236
264
  env_file = self[:ssh_env_file]
237
265
  escaped_val = Regexp.escape(val).gsub('/', '\/').gsub(';', '\;')
238
266
  #see if the key/value pair already exists
239
- if exec(Beaker::Command.new("grep -e #{key}=.*#{escaped_val} #{env_file}"), :acceptable_exit_codes => (0..255) ).exit_code == 0
267
+ if exec(Beaker::Command.new("grep #{key}=.*#{escaped_val} #{env_file}"), :acceptable_exit_codes => (0..255) ).exit_code == 0
240
268
  return #nothing to do here, key value pair already exists
241
269
  #see if the key already exists
242
270
  elsif exec(Beaker::Command.new("grep #{key} #{env_file}"), :acceptable_exit_codes => (0..255) ).exit_code == 0
243
- exec(Beaker::SedCommand.new(self['HOSTS'][name]['platform'], "s/#{key}=/#{key}=#{escaped_val}:/", env_file))
271
+ exec(Beaker::SedCommand.new(self['platform'], "s/#{key}=/#{key}=#{escaped_val}:/", env_file))
244
272
  else
245
273
  exec(Beaker::Command.new("echo \"#{key}=#{val}\" >> #{env_file}"))
246
274
  end
275
+ #update the profile.d to current state
276
+ #match it to the contents of ssh_env_file
277
+ mirror_env_to_profile_d(env_file)
247
278
  else #powershell windows
248
279
  #see if the key/value pair already exists
249
280
  result = exec(Beaker::Command.new("set #{key}"), :acceptable_exit_codes => (0..255))
@@ -259,6 +290,15 @@ module Beaker
259
290
  end
260
291
  end
261
292
 
293
+ #Return the value of a specific env var
294
+ #@param [String] key The key to look for
295
+ #@example
296
+ # host.get_env_var('path')
297
+ def get_env_var key
298
+ key = key.to_s.upcase
299
+ exec(Beaker::Command.new("env | grep #{key}"), :acceptable_exit_codes => (0..255)).stdout.chomp
300
+ end
301
+
262
302
  #Delete the provided key/val from the current ssh environment
263
303
  #@param [String] key The key to delete the value from
264
304
  #@param [String] val The value to delete for the key
@@ -267,11 +307,17 @@ module Beaker
267
307
  def delete_env_var key, val
268
308
  key = key.to_s.upcase
269
309
  if self.is_cygwin?
310
+ env_file = self[:ssh_env_file]
270
311
  val = Regexp.escape(val).gsub('/', '\/').gsub(';', '\;')
271
312
  #if the key only has that single value remove the entire line
272
- exec(Beaker::SedCommand.new(self['HOSTS'][name]['platform'], "/#{key}=#{val}$/d", self[:ssh_env_file]))
273
- #if the key has multiple values and we only need to remove the provided val
274
- exec(Beaker::SedCommand.new(self['HOSTS'][name]['platform'], "s/#{key}=\\(.*[:;]*\\)#{val}[:;]*/#{key}=\\1/", self[:ssh_env_file]))
313
+ exec(Beaker::SedCommand.new(self['platform'], "/#{key}=#{val}$/d", env_file))
314
+ #value in middle of list
315
+ exec(Beaker::SedCommand.new(self['platform'], "s/#{key}=\\(.*\\)[;:]#{val}/#{key}=\\1/", env_file))
316
+ #value in start of list
317
+ exec(Beaker::SedCommand.new(self['platform'], "s/#{key}=#{val}[;:]/#{key}=/", env_file))
318
+ #update the profile.d to current state
319
+ #match it to the contents of ssh_env_file
320
+ mirror_env_to_profile_d(env_file)
275
321
  else #powershell windows
276
322
  #get the current value of the key
277
323
  result = exec(Beaker::Command.new("set #{key}"), :acceptable_exit_codes => (0..255))
@@ -337,6 +383,12 @@ module Beaker
337
383
  end
338
384
  end
339
385
 
386
+ # Recursively remove the path provided
387
+ # @param [String] path The path to remove
388
+ def rm_rf path
389
+ exec(Beaker::Command.new("rm -rf #{path}"))
390
+ end
391
+
340
392
  # Create the provided directory structure on the host
341
393
  # @param [String] dir The directory structure to create on the host
342
394
  # @return [Boolean] True, if directory construction succeeded, otherwise False
@@ -344,18 +396,31 @@ module Beaker
344
396
  if self.is_cygwin?
345
397
  cmd = "mkdir -p #{dir}"
346
398
  else
347
- cmd = "if not exist #{dir.gsub!('/','\\')} (md #{dir.gsub!('/','\\')})"
399
+ windows_dirstring = dir.gsub('/','\\')
400
+ cmd = "if not exist #{windows_dirstring} (md #{windows_dirstring})"
348
401
  end
349
402
 
350
403
  result = exec(Beaker::Command.new(cmd), :acceptable_exit_codes => [0, 1])
351
404
  result.exit_code == 0
352
405
  end
353
406
 
354
- # scp files from the localhost to this test host, if a directory is provided it is recursively copied
407
+ # scp files from the localhost to this test host, if a directory is provided it is recursively copied.
408
+ # If the provided source is a directory both the contents of the directory and the directory
409
+ # itself will be copied to the host, if you only want to copy directory contents you will either need to specify
410
+ # the contents file by file or do a separate 'mv' command post scp_to to create the directory structure as desired.
411
+ # To determine if a file/dir is 'ignored' we compare to any contents of the source dir and NOT any part of the path
412
+ # to that source dir.
413
+ #
355
414
  # @param source [String] The path to the file/dir to upload
356
415
  # @param target [String] The destination path on the host
357
416
  # @param options [Hash{Symbol=>String}] Options to alter execution
358
417
  # @option options [Array<String>] :ignore An array of file/dir paths that will not be copied to the host
418
+ # @example
419
+ # do_scp_to('source/dir1/dir2/dir3', 'target')
420
+ # -> will result in creation of target/source/dir1/dir2/dir3 on host
421
+ #
422
+ # do_scp_to('source/file.rb', 'target', { :ignore => 'file.rb' }
423
+ # -> will result in not files copyed to the host, all are ignored
359
424
  def do_scp_to source, target, options
360
425
  @logger.notify "localhost $ scp #{source} #{@name}:#{target} {:ignore => #{options[:ignore]}}"
361
426
 
@@ -365,9 +430,10 @@ module Beaker
365
430
  ignore_re = nil
366
431
  if has_ignore
367
432
  ignore_arr = Array(options[:ignore]).map do |entry|
368
- "((\/|\\A)#{entry}(\/|\\z))".gsub(/\./, '\.')
433
+ "((\/|\\A)#{Regexp.escape(entry)}(\/|\\z))"
369
434
  end
370
435
  ignore_re = Regexp.new(ignore_arr.join('|'))
436
+ @logger.debug("going to ignore #{ignore_re}")
371
437
  end
372
438
 
373
439
  # either a single file, or a directory with no ignores
@@ -388,7 +454,7 @@ module Beaker
388
454
  end
389
455
  else # a directory with ignores
390
456
  dir_source = Dir.glob("#{source}/**/*").reject do |f|
391
- f =~ ignore_re
457
+ f.gsub(/\A#{Regexp.escape(source)}/, '') =~ ignore_re #only match against subdirs, not full path
392
458
  end
393
459
  @logger.trace "After rejecting ignored files/dirs, going to scp [#{dir_source.join(", ")}]"
394
460
 
@@ -400,7 +466,7 @@ module Beaker
400
466
  required_dirs.each do |dir|
401
467
  dir_path = Pathname.new(dir)
402
468
  if dir_path.absolute?
403
- mkdir_p(File.join(target, dir.gsub(source, '')))
469
+ mkdir_p(File.join(target, dir.gsub(/#{Regexp.escape(File.dirname(File.absolute_path(source)))}/, '')))
404
470
  else
405
471
  mkdir_p( File.join(target, dir) )
406
472
  end
@@ -411,7 +477,7 @@ module Beaker
411
477
  dir_source.each do |s|
412
478
  s_path = Pathname.new(s)
413
479
  if s_path.absolute?
414
- file_path = File.join(target, File.dirname(s).gsub(source,''))
480
+ file_path = File.join(target, File.dirname(s).gsub(/#{Regexp.escape(File.dirname(File.absolute_path(source)))}/,''))
415
481
  else
416
482
  file_path = File.join(target, File.dirname(s))
417
483
  end
@@ -12,6 +12,10 @@ module PSWindows::Exec
12
12
  (abs ? ABS_CMD : CMD) + " /c echo. 2> #{file}"
13
13
  end
14
14
 
15
+ def rm_rf path
16
+ execute("del /s /q #{path}")
17
+ end
18
+
15
19
  def path
16
20
  'c:/windows/system32;c:/windows'
17
21
  end
@@ -26,7 +26,7 @@ module Unix
26
26
  'puppetbin' => '/opt/puppet/bin/puppet',
27
27
  'puppetbindir' => '/opt/puppet/bin',
28
28
  'puppetsbindir' => '/opt/puppet/sbin',
29
- 'systembindir' => '/opt/puppet/bin',
29
+ 'privatebindir' => '/opt/puppetlabs/puppet/bin',
30
30
  'puppetvardir' => '/var/opt/lib/pe-puppet',
31
31
  'hieradatadir' => '/var/lib/hiera',
32
32
  'hieraconf' => '/etc/puppetlabs/puppet/hiera.yaml',
@@ -48,7 +48,7 @@ module Unix
48
48
  'puppetvardir' => '/var/lib/puppet',
49
49
  'puppetbin' => '/usr/bin/puppet',
50
50
  'puppetbindir' => '/usr/bin',
51
- 'systembindir' => '/usr/bin',
51
+ 'privatebindir' => '/usr/bin',
52
52
  'hieralibdir' => '/opt/puppet-git-repos/hiera/lib',
53
53
  'hierapuppetlibdir' => '/opt/puppet-git-repos/hiera-puppet/lib',
54
54
  'hierabindir' => '/opt/puppet-git-repos/hiera/bin',
@@ -64,17 +64,8 @@ module Unix
64
64
  h = Beaker::Options::OptionsHash.new
65
65
  h.merge({
66
66
  'user' => 'root',
67
- 'group' => 'puppet',
68
- 'puppetserver-confdir' => '/etc/puppetlabs/puppetserver/conf.d',
69
- 'puppetservice' => 'puppetserver',
70
- 'puppetpath' => '/etc/puppetlabs/puppet',
71
- 'puppetconfdir' => '/etc/puppetlabs/puppet',
72
- 'puppetvardir' => '/opt/puppetlabs/puppet/cache',
73
- 'puppetbin' => '/opt/puppetlabs/puppet/bin/puppet',
74
67
  'puppetbindir' => '/opt/puppetlabs/bin',
75
- 'systembindir' => '/usr/bin',
76
- 'hieradatadir' => '/etc/puppetlabs/code/hieradata',
77
- 'hieraconf' => '/etc/puppetlabs/code/hiera.yaml',
68
+ 'privatebindir' => '/opt/puppetlabs/puppet/bin',
78
69
  'distmoduledir' => '/etc/puppetlabs/code/modules',
79
70
  'sitemoduledir' => '/opt/puppetlabs/puppet/modules',
80
71
  'pathseparator' => ':',
@@ -58,17 +58,8 @@ module Windows
58
58
  h = Beaker::Options::OptionsHash.new
59
59
  h.merge({
60
60
  'user' => 'Administrator',
61
- 'group' => 'Administrators',
62
- # 'puppetserver-confdir' not applicable on Windows
63
- # 'puppetservice' not applicable on Windows
64
- 'puppetpath' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
65
- 'puppetconfdir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
66
- 'puppetvardir' => '`cygpath -smF 35`/PuppetLabs/puppet/cache',
67
- # 'puppetbin' not required on Windows
68
- 'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/bin:/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/sys/ruby/bin',
69
- # systembindir not required on Windows
70
- 'hieradatadir' => '`cygpath -smF 35`/Puppetlabs/code/hieradata',
71
- 'hieraconf' => '`cygpath -smF 35`/Puppetlabs/code/hiera.yaml',
61
+ 'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/bin',
62
+ 'privatebindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/sys/ruby/bin',
72
63
  'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/code/modules',
73
64
  # sitemoduledir not included (check PUP-4049 for more info)
74
65
  'pathseparator' => ';',
@@ -14,7 +14,7 @@ module Windows::File
14
14
  end
15
15
 
16
16
  def file_exist?(path)
17
- result = exec(Beaker::Command.new("test -e #{path}"), :acceptable_exit_codes => [0, 1])
17
+ result = exec(Beaker::Command.new("test -e '#{path}'"), :acceptable_exit_codes => [0, 1])
18
18
  result.exit_code == 0
19
19
  end
20
20
  end
@@ -38,7 +38,7 @@ module Windows::Pkg
38
38
  #Examine the host system to determine the architecture, overrides default host determine_if_x86_64 so that wmic is used
39
39
  #@return [Boolean] true if x86_64, false otherwise
40
40
  def determine_if_x86_64
41
- identify_windows_architecture =~ /64/
41
+ (identify_windows_architecture =~ /64/) == 0
42
42
  end
43
43
 
44
44
  private
@@ -350,7 +350,7 @@ module Beaker
350
350
  if host['platform'] =~ /debian|ubuntu|cumulus/
351
351
  host.exec(Command.new("sudo su -c \"service ssh restart\""), {:pty => true})
352
352
  elsif host['platform'] =~ /centos|el-|redhat|fedora|eos/
353
- host.exec(Command.new("sudo -E /sbin/service sshd restart"), {:pty => true})
353
+ host.exec(Command.new("sudo -E /sbin/service sshd reload"), {:pty => true})
354
354
  else
355
355
  @logger.warn("Attempting to update ssh on non-supported platform: #{host.name}: #{host['platform']}")
356
356
  end
@@ -30,9 +30,11 @@ module Beaker
30
30
  Beaker::Fusion
31
31
  when /^ec2$/
32
32
  Beaker::AwsSdk
33
+ when /^vmpooler$/
34
+ Beaker::Vmpooler
33
35
  when /^vcloud$/
34
36
  if options['pooling_api']
35
- Beaker::VcloudPooled
37
+ Beaker::Vmpooler
36
38
  else
37
39
  Beaker::Vcloud
38
40
  end
@@ -131,6 +133,6 @@ module Beaker
131
133
  end
132
134
  end
133
135
 
134
- [ 'vsphere_helper', 'vagrant', 'vagrant_virtualbox', 'vagrant_parallels', 'vagrant_libvirt', 'vagrant_fusion', 'vagrant_workstation', 'fusion', 'aws_sdk', 'vsphere', 'vcloud', 'vcloud_pooled', 'aixer', 'solaris', 'docker', 'google_compute', 'openstack' ].each do |lib|
136
+ [ 'vsphere_helper', 'vagrant', 'vagrant_virtualbox', 'vagrant_parallels', 'vagrant_libvirt', 'vagrant_fusion', 'vagrant_workstation', 'fusion', 'aws_sdk', 'vsphere', 'vmpooler', 'vcloud', 'aixer', 'solaris', 'docker', 'google_compute', 'openstack' ].each do |lib|
135
137
  require "beaker/hypervisor/#{lib}"
136
138
  end
@@ -3,7 +3,7 @@ require 'json'
3
3
  require 'net/http'
4
4
 
5
5
  module Beaker
6
- class VcloudPooled < Beaker::Hypervisor
6
+ class Vmpooler < Beaker::Hypervisor
7
7
  SSH_EXCEPTIONS = [
8
8
  SocketError,
9
9
  Timeout::Error,
@@ -15,14 +15,10 @@ module Beaker
15
15
  Errno::ENETUNREACH,
16
16
  ]
17
17
 
18
- def initialize(vcloud_hosts, options)
18
+ def initialize(vmpooler_hosts, options)
19
19
  @options = options
20
20
  @logger = options[:logger]
21
- @hosts = vcloud_hosts
22
-
23
- raise 'You must specify a datastore for vCloud instances!' unless @options['datastore']
24
- raise 'You must specify a resource pool for vCloud instances!' unless @options['resourcepool']
25
- raise 'You must specify a folder for vCloud instances!' unless @options['folder']
21
+ @hosts = vmpooler_hosts
26
22
  end
27
23
 
28
24
  def check_url url
@@ -66,7 +62,7 @@ module Beaker
66
62
  request_payload[h['template']] = (request_payload[h['template']].to_i + 1).to_s
67
63
  end
68
64
 
69
- @logger.notify "Requesting VM set from vCloud host pool"
65
+ @logger.notify "Requesting VM set from vmpooler"
70
66
 
71
67
  last_wait, wait = 0, 1
72
68
  waited = 0 #the amount of time we've spent waiting for this host to provision
@@ -93,20 +89,20 @@ module Beaker
93
89
 
94
90
  h['vmhostname'] = domain ? "#{hostname}.#{domain}" : hostname
95
91
 
96
- @logger.notify "Using available vCloud host '#{h['vmhostname']}' (#{h.name})"
92
+ @logger.notify "Using available host '#{h['vmhostname']}' (#{h.name})"
97
93
  end
98
94
  else
99
- raise "VcloudPooled.provision - requested vCloud hosts not available"
95
+ raise "Vmpooler.provision - requested host set not available"
100
96
  end
101
97
  rescue JSON::ParserError, RuntimeError, *SSH_EXCEPTIONS => e
102
98
  if waited <= @options[:timeout].to_i
103
- @logger.debug("Retrying provision for vCloud host after waiting #{wait} second(s) (failed with #{e.class})")
99
+ @logger.debug("Retrying provision for vmpooler host after waiting #{wait} second(s) (failed with #{e.class})")
104
100
  sleep wait
105
101
  waited += wait
106
102
  last_wait, wait = wait, last_wait + wait
107
103
  retry
108
104
  end
109
- report_and_raise(@logger, e, 'vCloudPooled.provision')
105
+ report_and_raise(@logger, e, 'Vmpooler.provision')
110
106
  end
111
107
 
112
108
  @logger.notify 'Spent %.2f seconds grabbing VMs' % (Time.now - start)
@@ -120,7 +116,7 @@ module Beaker
120
116
 
121
117
  start = Time.now
122
118
  vm_names.each do |name|
123
- @logger.notify "Handing '#{name}' back to pooling API for VM destruction"
119
+ @logger.notify "Handing '#{name}' back to vmpooler for VM destruction"
124
120
 
125
121
  uri = URI.parse(get_template_url(@options['pooling_api'], name))
126
122
 
@@ -130,7 +126,7 @@ module Beaker
130
126
  begin
131
127
  response = http.request(request)
132
128
  rescue *SSH_EXCEPTIONS => e
133
- report_and_raise(@logger, e, 'vCloudPooled.cleanup (http.request)')
129
+ report_and_raise(@logger, e, 'Vmpooler.cleanup (http.request)')
134
130
  end
135
131
  end
136
132
 
@@ -160,6 +160,7 @@ module Beaker
160
160
  :pe_version_file_win => 'LATEST-win',
161
161
  :host_env => {},
162
162
  :ssh_env_file => '~/.ssh/environment',
163
+ :profile_d_env_file => '/etc/profile.d/beaker_env.sh',
163
164
  :answers => {
164
165
  :q_puppet_enterpriseconsole_auth_user_email => 'admin@example.com',
165
166
  :q_puppet_enterpriseconsole_auth_password => '~!@#$%^*-/ aZ',