beaker 1.11.0 → 1.11.1
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 +8 -8
- data/lib/beaker/answers/version30.rb +1 -1
- data/lib/beaker/cli.rb +13 -2
- data/lib/beaker/dsl/helpers.rb +6 -6
- data/lib/beaker/dsl/install_utils.rb +18 -5
- data/lib/beaker/host/unix.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +1 -1
- data/lib/beaker/host/windows/pkg.rb +3 -3
- data/lib/beaker/host_prebuilt_steps.rb +6 -6
- data/lib/beaker/hypervisor.rb +3 -3
- data/lib/beaker/hypervisor/blimper.rb +3 -3
- data/lib/beaker/hypervisor/docker.rb +4 -8
- data/lib/beaker/hypervisor/fusion.rb +3 -3
- data/lib/beaker/hypervisor/google_compute.rb +17 -7
- data/lib/beaker/hypervisor/google_compute_helper.rb +1 -1
- data/lib/beaker/hypervisor/solaris.rb +1 -1
- data/lib/beaker/hypervisor/vagrant.rb +1 -1
- data/lib/beaker/hypervisor/vcloud.rb +1 -1
- data/lib/beaker/hypervisor/vcloud_pooled.rb +3 -3
- data/lib/beaker/hypervisor/vsphere.rb +1 -1
- data/lib/beaker/logger.rb +14 -14
- data/lib/beaker/network_manager.rb +5 -5
- data/lib/beaker/options/command_line_parser.rb +12 -13
- data/lib/beaker/options/hosts_file_parser.rb +1 -1
- data/lib/beaker/options/options_file_parser.rb +4 -4
- data/lib/beaker/options/parser.rb +11 -5
- data/lib/beaker/options/pe_version_scraper.rb +2 -2
- data/lib/beaker/platform.rb +4 -4
- data/lib/beaker/shared/error_handler.rb +2 -2
- data/lib/beaker/shared/host_role_parser.rb +7 -7
- data/lib/beaker/ssh_connection.rb +2 -2
- data/lib/beaker/test_suite.rb +1 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/hypervisor/docker_spec.rb +19 -13
- data/spec/beaker/options/command_line_parser_spec.rb +2 -2
- data/spec/beaker/options/parser_spec.rb +108 -85
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGQ0YzFjMDg1ZWEzZmIxNTgzOWQ0NmM4MmIyODM1NmNiZjA2YzBjZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzMxOTllOGEwMWRjZDQ0MzMxY2VkMDI4ZDBmZWExZGE4NGVhZTgwNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmFiYjE3ODI1NWRiZDc0ZDg0ODJmYjdmOTU0ZjczYmE3YTc2OTdkNDY2ZTQx
|
10
|
+
MjJkYTRjYjM5MzQwZDIxNWYyMTAwYTllNzRkNGZjZWFmZDNhNDhmMmRlZjQ0
|
11
|
+
OTc3YTBhYTgwYTg5Nzc2ZWI0ZWVhODA3YjI5NTlmNDc4NmVhYmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Zjk0OGFhOWE5MGY2NDk4MzY3MjNiNGMyZWRmNjhlNjM4NWUzNTRiZTJmODE0
|
14
|
+
OTE4ZWIwNzkxZTJiMjY3N2ZmMjY1OTE2YzQ5NDdiYjIxMDEzOTdiN2JkNWJj
|
15
|
+
OGJjZjFlOTg3NzA4NWJkODk3YTRiNWRjM2FhYzM4ZDI1ZjJlNTA=
|
@@ -66,7 +66,7 @@ module Beaker
|
|
66
66
|
end
|
67
67
|
|
68
68
|
# Common answers for console and database
|
69
|
-
dashboard_password = "'#{options[:answers][:q_puppet_enterpriseconsole_auth_password]}'"
|
69
|
+
dashboard_password = "'#{options[:answers][:q_puppet_enterpriseconsole_auth_password]}'"
|
70
70
|
puppetdb_password = "'#{options[:answers][:q_puppetdb_password]}'"
|
71
71
|
|
72
72
|
console_database_a = {
|
data/lib/beaker/cli.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Beaker
|
2
2
|
class CLI
|
3
|
-
VERSION_STRING =
|
3
|
+
VERSION_STRING =
|
4
4
|
" wWWWw
|
5
5
|
|o o|
|
6
6
|
| O | %s!
|
@@ -105,7 +105,11 @@ module Beaker
|
|
105
105
|
@network_manager.cleanup
|
106
106
|
end
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
|
+
@logger.error "\nFailed to execute tests!\n"
|
110
|
+
print_reproduction_info( :error )
|
111
|
+
|
112
|
+
exit 1
|
109
113
|
else
|
110
114
|
#cleanup on success
|
111
115
|
if @options[:preserve_hosts] =~ /(never)|(onfail)/
|
@@ -114,6 +118,7 @@ module Beaker
|
|
114
118
|
@network_manager.cleanup
|
115
119
|
end
|
116
120
|
end
|
121
|
+
print_reproduction_info( :debug ) if @logger.is_debug?
|
117
122
|
end
|
118
123
|
end
|
119
124
|
|
@@ -131,5 +136,11 @@ module Beaker
|
|
131
136
|
).run_and_raise_on_failure
|
132
137
|
end
|
133
138
|
|
139
|
+
def print_reproduction_info( log_level = :debug )
|
140
|
+
puts ''
|
141
|
+
@logger.send(log_level, "You can reproduce this run with:\n")
|
142
|
+
@logger.send(log_level, @options[:command_line])
|
143
|
+
puts ''
|
144
|
+
end
|
134
145
|
end
|
135
146
|
end
|
data/lib/beaker/dsl/helpers.rb
CHANGED
@@ -92,7 +92,7 @@ module Beaker
|
|
92
92
|
when 0
|
93
93
|
yield self
|
94
94
|
#block with arity of 1 or greater, hand back the result object
|
95
|
-
else
|
95
|
+
else
|
96
96
|
yield @result
|
97
97
|
end
|
98
98
|
end
|
@@ -665,7 +665,7 @@ module Beaker
|
|
665
665
|
# codes that will NOT raise an error when found upon
|
666
666
|
# command completion. If provided, these values will
|
667
667
|
# be combined with those used in :catch_failures and
|
668
|
-
# :expect_failures to create the full list of
|
668
|
+
# :expect_failures to create the full list of
|
669
669
|
# passing exit codes.
|
670
670
|
#
|
671
671
|
# @option opts [Hash] :environment Additional environment variables to be
|
@@ -695,14 +695,14 @@ module Beaker
|
|
695
695
|
# failure during its execution.
|
696
696
|
#
|
697
697
|
# @option opts [Boolean] :future_parser (false) This option enables
|
698
|
-
# the future parser option that is available
|
698
|
+
# the future parser option that is available
|
699
699
|
# from Puppet verion 3.2
|
700
700
|
# By default it will use the 'current' parser.
|
701
701
|
#
|
702
702
|
# @option opts [String] :modulepath The search path for modules, as
|
703
703
|
# a list of directories separated by the system
|
704
704
|
# path separator character. (The POSIX path separator
|
705
|
-
# is ‘:’, and the Windows path separator is ‘;’.)
|
705
|
+
# is ‘:’, and the Windows path separator is ‘;’.)
|
706
706
|
#
|
707
707
|
# @param [Block] block This method will yield to a block of code passed
|
708
708
|
# by the caller; this can be used for additional
|
@@ -867,7 +867,7 @@ module Beaker
|
|
867
867
|
# forge api v3 canonical source is forgeapi.puppetlabs.com
|
868
868
|
#
|
869
869
|
# @param machine [String] the host to perform the stub on
|
870
|
-
# @param forge_host [String] The URL to use as the forge alias, will default to using :forge_host in the
|
870
|
+
# @param forge_host [String] The URL to use as the forge alias, will default to using :forge_host in the
|
871
871
|
# global options hash
|
872
872
|
def stub_forge_on(machine, forge_host = nil)
|
873
873
|
#use global options hash
|
@@ -920,7 +920,7 @@ module Beaker
|
|
920
920
|
agent_running = (result.exit_code == 0)
|
921
921
|
sleep 2 unless agent_running
|
922
922
|
end
|
923
|
-
|
923
|
+
|
924
924
|
if agent['platform'].include?('solaris')
|
925
925
|
on(agent, '/usr/sbin/svcadm disable -s svc:/network/pe-puppet:default')
|
926
926
|
elsif agent['platform'].include?('aix')
|
@@ -313,7 +313,7 @@ module Beaker
|
|
313
313
|
host['pe_installer'] ||= 'puppet-enterprise-installer'
|
314
314
|
if host['platform'] !~ /windows/
|
315
315
|
platform = use_all_tar ? 'all' : host['platform']
|
316
|
-
version =
|
316
|
+
version = host['pe_ver'] || opts[:pe_ver]
|
317
317
|
host['dist'] = "puppet-enterprise-#{version}-#{platform}"
|
318
318
|
end
|
319
319
|
host['working_dir'] = "/tmp/" + Time.new.strftime("%Y-%m-%d_%H.%M.%S") #unique working dirs make me happy
|
@@ -329,7 +329,7 @@ module Beaker
|
|
329
329
|
on host, installer_cmd(host, opts)
|
330
330
|
else
|
331
331
|
# We only need answers if we're using the classic installer
|
332
|
-
version =
|
332
|
+
version = host['pe_ver'] || opts[:pe_ver]
|
333
333
|
if (! host['roles'].include? 'frictionless') || version_is_less(version, '3.2.0')
|
334
334
|
answers = Beaker::Answers.answers(opts[:pe_ver] || host['pe_ver'], hosts, master_certname, opts)
|
335
335
|
create_remote_file host, "#{host['working_dir']}/answers", Beaker::Answers.answer_string(host, answers)
|
@@ -448,7 +448,7 @@ module Beaker
|
|
448
448
|
#
|
449
449
|
# @api dsl
|
450
450
|
# @return nil
|
451
|
-
def install_puppet
|
451
|
+
def install_puppet(opts = {})
|
452
452
|
hosts.each do |host|
|
453
453
|
if host['platform'] =~ /el-(5|6|7)/
|
454
454
|
relver = $1
|
@@ -469,6 +469,19 @@ module Beaker
|
|
469
469
|
on host, 'dpkg -i puppetlabs-release-$(lsb_release -c -s).deb'
|
470
470
|
on host, 'apt-get update'
|
471
471
|
on host, 'apt-get install -y puppet'
|
472
|
+
elsif host['platform'] =~ /windows/
|
473
|
+
relver = opts[:version]
|
474
|
+
on host, "curl -O http://downloads.puppetlabs.com/windows/puppet-#{relver}.msi"
|
475
|
+
on host, "msiexec /qn /i puppet-#{relver}.msi"
|
476
|
+
|
477
|
+
#Because the msi installer doesn't add Puppet to the environment path
|
478
|
+
if fact_on(host, 'architecture').eql?('x86_64')
|
479
|
+
install_dir = '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin'
|
480
|
+
else
|
481
|
+
install_dir = '/cygdrive/c/Program Files/Puppet Labs/Puppet/bin'
|
482
|
+
end
|
483
|
+
on host, %Q{ echo 'export PATH=$PATH:"#{install_dir}"' > /etc/bash.bashrc }
|
484
|
+
|
472
485
|
else
|
473
486
|
raise "install_puppet() called for unsupported platform '#{host['platform']}' on '#{host.name}'"
|
474
487
|
end
|
@@ -506,7 +519,7 @@ module Beaker
|
|
506
519
|
# Will contain a LATEST file indicating the latest build to install.
|
507
520
|
# This is ignored if a pe_upgrade_ver and pe_upgrade_dir are specified
|
508
521
|
# in the host configuration file.
|
509
|
-
# @example
|
522
|
+
# @example
|
510
523
|
# upgrade_pe("http://neptune.puppetlabs.lan/3.0/ci-ready/")
|
511
524
|
#
|
512
525
|
# @note Install file names are assumed to be of the format puppet-enterprise-VERSION-PLATFORM.(tar)|(tar.gz)
|
@@ -516,7 +529,7 @@ module Beaker
|
|
516
529
|
hosts.each do |host|
|
517
530
|
host['pe_dir'] = host['pe_upgrade_dir'] || path
|
518
531
|
if host['platform'] =~ /windows/
|
519
|
-
host['pe_ver'] = host['pe_upgrade_ver'] || options['pe_upgrade_ver'] ||
|
532
|
+
host['pe_ver'] = host['pe_upgrade_ver'] || options['pe_upgrade_ver'] ||
|
520
533
|
Options::PEVersionScraper.load_pe_version(host['pe_dir'], options[:pe_version_file_win])
|
521
534
|
else
|
522
535
|
host['pe_ver'] = host['pe_upgrade_ver'] || options['pe_upgrade_ver'] ||
|
data/lib/beaker/host/unix.rb
CHANGED
@@ -23,7 +23,7 @@ module Unix
|
|
23
23
|
'user' => 'root',
|
24
24
|
'group' => 'pe-puppet',
|
25
25
|
'service-wait' => false,
|
26
|
-
'service-prefix'=> '/etc/init.d/',
|
26
|
+
'service-prefix'=> '/etc/init.d/',
|
27
27
|
'puppetservice' => 'pe-httpd',
|
28
28
|
'puppetpath' => '/etc/puppetlabs/puppet',
|
29
29
|
'puppetbin' => '/opt/puppet/bin/puppet',
|
data/lib/beaker/host/unix/pkg.rb
CHANGED
@@ -3,7 +3,7 @@ module Windows::Pkg
|
|
3
3
|
|
4
4
|
def check_for_package(name)
|
5
5
|
result = exec(Beaker::Command.new("which #{name}"), :acceptable_exit_codes => (0...127))
|
6
|
-
result.exit_code == 0
|
6
|
+
result.exit_code == 0
|
7
7
|
end
|
8
8
|
|
9
9
|
def install_package(name, cmdline_args = '')
|
@@ -23,7 +23,7 @@ module Windows::Pkg
|
|
23
23
|
if not check_for_package(cygwin)
|
24
24
|
execute("curl --retry 5 http://cygwin.com/#{cygwin} -o /cygdrive/c/Windows/System32/#{cygwin}")
|
25
25
|
end
|
26
|
-
execute("#{cygwin} -q -n -N -d -R #{cmdline_args} #{rootdir} -s http://cygwin.osuosl.org -P #{name}")
|
26
|
+
execute("#{cygwin} -q -n -N -d -R #{cmdline_args} #{rootdir} -s http://cygwin.osuosl.org -P #{name}")
|
27
27
|
end
|
28
28
|
|
29
29
|
def uninstall_package(name, cmdline_args = '')
|
@@ -35,7 +35,7 @@ module Windows::Pkg
|
|
35
35
|
# @api private
|
36
36
|
def identify_windows_architecture
|
37
37
|
arch = nil
|
38
|
-
execute("echo '' | wmic os get osarchitecture",
|
38
|
+
execute("echo '' | wmic os get osarchitecture",
|
39
39
|
:acceptable_exit_codes => (0...127)) do |result|
|
40
40
|
|
41
41
|
arch = if result.exit_code == 0
|
@@ -71,7 +71,7 @@ module Beaker
|
|
71
71
|
end
|
72
72
|
|
73
73
|
#Validate that hosts are prepared to be used as SUTs, if packages are missing attempt to
|
74
|
-
#install them. Verifies the presence of {HostPrebuiltSteps::PACKAGES} on all hosts,
|
74
|
+
#install them. Verifies the presence of {HostPrebuiltSteps::PACKAGES} on all hosts,
|
75
75
|
#{HostPrebuiltSteps::UNIX_PACKAGES} on unix platform hosts and {HostPrebuiltSteps::SLES_PACKAGES}
|
76
76
|
#on sles (SUSE, Enterprise Linux) hosts.
|
77
77
|
# @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon
|
@@ -148,8 +148,8 @@ module Beaker
|
|
148
148
|
report_and_raise(logger, e, "add_master_entry")
|
149
149
|
end
|
150
150
|
|
151
|
-
#Install a set of authorized keys using {HostPrebuiltSteps::ROOT_KEYS_SCRIPT}. This is a
|
152
|
-
#convenience method to allow for easy login to hosts after they have been provisioned with
|
151
|
+
#Install a set of authorized keys using {HostPrebuiltSteps::ROOT_KEYS_SCRIPT}. This is a
|
152
|
+
#convenience method to allow for easy login to hosts after they have been provisioned with
|
153
153
|
#Beaker.
|
154
154
|
# @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon
|
155
155
|
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
@@ -204,7 +204,7 @@ module Beaker
|
|
204
204
|
if host.is_a? Array
|
205
205
|
host.map { |h| apt_get_update(h) }
|
206
206
|
else
|
207
|
-
if host[:platform] =~ /(ubuntu)|(debian)/
|
207
|
+
if host[:platform] =~ /(ubuntu)|(debian)/
|
208
208
|
host.exec(Command.new("apt-get update"))
|
209
209
|
end
|
210
210
|
end
|
@@ -227,7 +227,7 @@ module Beaker
|
|
227
227
|
end
|
228
228
|
|
229
229
|
#Alter apt configuration on ubuntu and debian host or hosts to internal Puppet Labs
|
230
|
-
# proxy {HostPrebuiltSteps::APT_CFG} proxy, alter pkg on solaris-11 host or hosts
|
230
|
+
# proxy {HostPrebuiltSteps::APT_CFG} proxy, alter pkg on solaris-11 host or hosts
|
231
231
|
# to point to interal Puppetlabs proxy {HostPrebuiltSteps::IPS_PKG_REPO}. Do nothing
|
232
232
|
# on non-ubuntu, debian or solaris-11 platform host or hosts.
|
233
233
|
# @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon
|
@@ -306,7 +306,7 @@ module Beaker
|
|
306
306
|
return search if search
|
307
307
|
end
|
308
308
|
|
309
|
-
#Determine the ip address of the provided host
|
309
|
+
#Determine the ip address of the provided host
|
310
310
|
# @param [Host] host the host to act upon
|
311
311
|
# @deprecated use {Host#get_ip}
|
312
312
|
def get_ip(host)
|
data/lib/beaker/hypervisor.rb
CHANGED
@@ -22,7 +22,7 @@ module Beaker
|
|
22
22
|
#@param [Hash] options options Options to alter execution
|
23
23
|
def self.create(type, hosts_to_provision, options)
|
24
24
|
@logger = options[:logger]
|
25
|
-
@logger.notify("Beaker::Hypervisor, found some #{type} boxes to create")
|
25
|
+
@logger.notify("Beaker::Hypervisor, found some #{type} boxes to create")
|
26
26
|
hyper_class = case type
|
27
27
|
when /aix/
|
28
28
|
Beaker::Aixer
|
@@ -51,7 +51,7 @@ module Beaker
|
|
51
51
|
when /none/
|
52
52
|
Beaker::Hypervisor
|
53
53
|
else
|
54
|
-
raise "Invalid hypervisor: #{type}"
|
54
|
+
raise "Invalid hypervisor: #{type}"
|
55
55
|
end
|
56
56
|
|
57
57
|
hypervisor = hyper_class.new(hosts_to_provision, options)
|
@@ -93,7 +93,7 @@ module Beaker
|
|
93
93
|
|
94
94
|
#Default validation steps to be run for a given hypervisor
|
95
95
|
def validate
|
96
|
-
if @options[:validate]
|
96
|
+
if @options[:validate]
|
97
97
|
validate_host(@hosts, @options)
|
98
98
|
end
|
99
99
|
end
|
@@ -19,8 +19,8 @@ module Beaker
|
|
19
19
|
@hosts.each do |host|
|
20
20
|
amitype = host['vmname'] || host['platform']
|
21
21
|
amisize = host['amisize'] || 'm1.small'
|
22
|
-
#use snapshot provided for this host
|
23
|
-
image_type = host['snapshot']
|
22
|
+
#use snapshot provided for this host
|
23
|
+
image_type = host['snapshot']
|
24
24
|
if not image_type
|
25
25
|
raise "No snapshot/image_type provided for blimpy provisioning"
|
26
26
|
end
|
@@ -79,7 +79,7 @@ module Beaker
|
|
79
79
|
host = @hosts.select { |host| host.name == name }[0]
|
80
80
|
host['ip'] = ship.dns
|
81
81
|
host.exec(Command.new("hostname #{name}"))
|
82
|
-
ip = get_ip(host)
|
82
|
+
ip = get_ip(host)
|
83
83
|
domain = get_domain_name(host)
|
84
84
|
etc_hosts += "#{ip}\t#{name}\t#{name}.#{domain}\n"
|
85
85
|
end
|
@@ -24,15 +24,10 @@ module Beaker
|
|
24
24
|
|
25
25
|
@logger.debug("Creating image")
|
26
26
|
image = ::Docker::Image.build(dockerfile_for(host), { :rm => true })
|
27
|
-
@logger.debug("Tagging image #{image.id} as #{host.name}")
|
28
|
-
image.tag({
|
29
|
-
:repo => host.name,
|
30
|
-
:force => true,
|
31
|
-
})
|
32
27
|
|
33
|
-
@logger.debug("Creating container from image")
|
28
|
+
@logger.debug("Creating container from image #{image.id}")
|
34
29
|
container = ::Docker::Container.create({
|
35
|
-
'Image' =>
|
30
|
+
'Image' => image.id,
|
36
31
|
'Hostname' => host.name,
|
37
32
|
})
|
38
33
|
|
@@ -75,7 +70,8 @@ module Beaker
|
|
75
70
|
end
|
76
71
|
end
|
77
72
|
|
78
|
-
|
73
|
+
# Do not remove the image if docker_reserve_image is set to true, otherwise remove it
|
74
|
+
if image = (host['docker_preserve_image'] ? nil : host['docker_image'])
|
79
75
|
@logger.debug("delete image #{image.id}")
|
80
76
|
begin
|
81
77
|
image.delete
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module Beaker
|
1
|
+
module Beaker
|
2
2
|
class Fusion < Beaker::Hypervisor
|
3
3
|
|
4
4
|
def initialize(fusion_hosts, options)
|
@@ -29,12 +29,12 @@ module Beaker
|
|
29
29
|
|
30
30
|
vm_snapshots = vm.snapshots.data
|
31
31
|
if vm_snapshots.nil? or vm_snapshots.empty?
|
32
|
-
raise "No snapshots available for VM #{host.name} (vmname: '#{vm_name}')"
|
32
|
+
raise "No snapshots available for VM #{host.name} (vmname: '#{vm_name}')"
|
33
33
|
end
|
34
34
|
|
35
35
|
available_snapshots = vm_snapshots.sort.join(", ")
|
36
36
|
@logger.notify "Available snapshots for #{host.name}: #{available_snapshots}"
|
37
|
-
snap_name = host["snapshot"]
|
37
|
+
snap_name = host["snapshot"]
|
38
38
|
raise "Could not find snapshot '#{snap_name}' for host #{host.name}!" unless vm.snapshots.data.include? snap_name
|
39
39
|
|
40
40
|
@logger.notify "Reverting #{host.name} to snapshot '#{snap_name}'"
|
@@ -8,6 +8,14 @@ module Beaker
|
|
8
8
|
#number of hours before an instance is considered a zombie
|
9
9
|
ZOMBIE = 3
|
10
10
|
|
11
|
+
#Create the array of metaData, each member being a hash with a :key and a :value. Sets
|
12
|
+
#:department, :project and :jenkins_build_url.
|
13
|
+
def format_metadata
|
14
|
+
[ {:key => :department, :value => @options[:department]},
|
15
|
+
{:key => :project, :value => @options[:project]},
|
16
|
+
{:key => :jenkins_build_url, :value => @options[:jenkins_build_url]} ].delete_if { |member| member[:value].nil? or member[:value].empty?}
|
17
|
+
end
|
18
|
+
|
11
19
|
#Create a new instance of the Google Compute Engine hypervisor object
|
12
20
|
#@param [<Host>] google_hosts The array of google hosts to provision, may ONLY be of platforms /centos-6-.*/ and
|
13
21
|
# /debian-7-.*/. We currently only support the Google Compute provided templates.
|
@@ -56,13 +64,15 @@ module Beaker
|
|
56
64
|
#add a new instance of the image
|
57
65
|
instance = @gce_helper.create_instance(host['vmhostname'], img, machineType, disk, start, attempts)
|
58
66
|
@logger.debug("Created Google Compute instance for #{host.name}: #{host['vmhostname']}")
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
|
68
|
+
#add metadata to instance, if there is any to set
|
69
|
+
mdata = format_metadata
|
70
|
+
if not mdata.empty?
|
71
|
+
@gce_helper.setMetadata_on_instance(host['vmhostname'], instance['metadata']['fingerprint'],
|
72
|
+
mdata,
|
73
|
+
start, attempts)
|
74
|
+
@logger.debug("Added tags to Google Compute instance #{host.name}: #{host['vmhostname']}")
|
75
|
+
end
|
66
76
|
|
67
77
|
#get ip for this host
|
68
78
|
host['ip'] = instance['networkInterfaces'][0]['accessConfigs'][0]['natIP']
|
@@ -158,7 +158,7 @@ module Beaker
|
|
158
158
|
end
|
159
159
|
return parsed
|
160
160
|
#retry errors
|
161
|
-
rescue Faraday::Error::ConnectionFailed => e
|
161
|
+
rescue Faraday::Error::ConnectionFailed => e
|
162
162
|
@logger.debug "ConnectionFailed attempting Google Compute execute command"
|
163
163
|
try += 1
|
164
164
|
last_error = e
|
@@ -14,7 +14,7 @@ module Beaker
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def provision
|
17
|
-
hypername = @fog_file[:default][:solaris_hypervisor_server]
|
17
|
+
hypername = @fog_file[:default][:solaris_hypervisor_server]
|
18
18
|
vmpath = @fog_file[:default][:solaris_hypervisor_vmpath]
|
19
19
|
snappaths = @fog_file[:default][:solaris_hypervisor_snappaths]
|
20
20
|
|
@@ -117,7 +117,7 @@ module Beaker
|
|
117
117
|
@logger.debug "configure vagrant boxes (set ssh-config, switch to root user, hack etc/hosts)"
|
118
118
|
@hosts.each do |host|
|
119
119
|
default_user = host['user']
|
120
|
-
|
120
|
+
|
121
121
|
set_ssh_config host, 'vagrant'
|
122
122
|
|
123
123
|
copy_ssh_to_root host, @options
|