beaker 1.8.2 → 1.9.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 +8 -8
- data/README.md +0 -3
- data/beaker.gemspec +2 -1
- data/lib/beaker/cli.rb +0 -1
- data/lib/beaker/dsl/helpers.rb +17 -0
- data/lib/beaker/dsl/install_utils.rb +85 -61
- data/lib/beaker/host_prebuilt_steps.rb +78 -4
- data/lib/beaker/hypervisor.rb +16 -6
- data/lib/beaker/hypervisor/blimper.rb +1 -0
- data/lib/beaker/hypervisor/google_compute.rb +152 -0
- data/lib/beaker/hypervisor/google_compute_helper.rb +577 -0
- data/lib/beaker/hypervisor/vagrant.rb +0 -10
- data/lib/beaker/hypervisor/vcloud.rb +18 -21
- data/lib/beaker/hypervisor/vcloud_pooled.rb +0 -1
- data/lib/beaker/options/parser.rb +1 -1
- data/lib/beaker/options/presets.rb +5 -1
- data/lib/beaker/platform.rb +26 -2
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/install_utils_spec.rb +2 -2
- data/spec/beaker/hypervisor/fusion_spec.rb +15 -0
- data/spec/beaker/hypervisor/vagrant_spec.rb +2 -2
- data/spec/beaker/options/parser_spec.rb +1 -1
- data/spec/helpers.rb +5 -1
- data/spec/mock_blimpy.rb +1 -1
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTkxODUzNWEzMjEwNjgxNjFhZWU2MDU5MGM4N2MzY2NhZjQ3ZjIzNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2YxYzI4MzNiMzI1MDQwZWU5YWQ2Y2ZmZWY1NWE4NjBjZjJlZjBiOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTIwNGFkOTQyYmFmMTE4NzMyYzlmN2FiMGMxOTg2NGY5NWUwZmJjZDU3YmI4
|
10
|
+
OGZiYzhhYWI5OTBlMzkzMjg0MjkzMDhiMmRkYWZhNmE0M2I1NzNmNjcyNjYw
|
11
|
+
YTg1OWVhNmJmMjY5NDU5OTZmODk4MTIwMDM0OGJjZTk4MmU1YmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjEzOGMzZmYwN2U1OGFjMDIwZDNjYThiNmE2N2M3YjBlZWVlMTIxNmRhN2U4
|
14
|
+
NTVmZDQ3MGU0MzYxNzAxYjc2ZTBhNTllN2Y4Mzc3NzUxZWJhYTZhZDBkNTI1
|
15
|
+
ZDA1MGJlZThiOTRhOTUwN2Y3YzU4MzdkZmUxZjFhNGE4ZTc3NDc=
|
data/README.md
CHANGED
@@ -19,6 +19,3 @@ See [LICENSE](LICENSE) file.
|
|
19
19
|
|
20
20
|
Please log tickets and issues at our [Beaker Issue Tracker](https://github.com/puppetlabs/beaker/issues). In addition there is an active #puppet-dev channel on Freenode.
|
21
21
|
|
22
|
-
We use semantic version numbers for our releases, and recommend that users stay
|
23
|
-
as up-to-date as possible by upgrading to patch releases and minor releases as
|
24
|
-
they become available.
|
data/beaker.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
# Testing dependencies
|
21
21
|
s.add_development_dependency 'rspec', '~> 2.14.0'
|
22
22
|
s.add_development_dependency 'fakefs', '0.4'
|
23
|
-
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'rake', '~> 10.1.0'
|
24
24
|
s.add_development_dependency 'simplecov' unless RUBY_VERSION < '1.9'
|
25
25
|
|
26
26
|
# Documentation dependencies
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.add_runtime_dependency 'rbvmomi', '1.8.1'
|
39
39
|
s.add_runtime_dependency 'blimpy', '~> 0.6'
|
40
40
|
s.add_runtime_dependency 'fission', '~> 0.4'
|
41
|
+
s.add_runtime_dependency 'google-api-client', '~> 0.6.4'
|
41
42
|
|
42
43
|
# These are transitive dependencies that we include or pin to because...
|
43
44
|
# Ruby 1.8 compatibility
|
data/lib/beaker/cli.rb
CHANGED
data/lib/beaker/dsl/helpers.rb
CHANGED
@@ -983,6 +983,23 @@ module Beaker
|
|
983
983
|
fact_on(default, name, opts)
|
984
984
|
end
|
985
985
|
|
986
|
+
#Run a curl command on the provided host(s)
|
987
|
+
#
|
988
|
+
# @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon,
|
989
|
+
# or a role (String or Symbol) that identifies one or more hosts.
|
990
|
+
# @param [String, Command] cmd The curl command to execute on *host*.
|
991
|
+
# @param [Proc] block Additional actions or assertions.
|
992
|
+
# @!macro common_opts
|
993
|
+
#
|
994
|
+
def curl_on(host, cmd, opts = {}, &block)
|
995
|
+
if options.is_pe? #check global options hash
|
996
|
+
on host, "curl --sslv3 %s" % cmd, opts, &block
|
997
|
+
else
|
998
|
+
on host, "curl %s" % cmd, opts, &block
|
999
|
+
end
|
1000
|
+
end
|
1001
|
+
|
1002
|
+
|
986
1003
|
end
|
987
1004
|
end
|
988
1005
|
end
|
@@ -154,7 +154,7 @@ module Beaker
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
#Determine is a given URL is accessible
|
157
|
+
#Determine is a given URL is accessible
|
158
158
|
#@param [String] link The URL to examine
|
159
159
|
#@return [Boolean] true if the URL has a '200' HTTP response code, false otherwise
|
160
160
|
#@example
|
@@ -172,11 +172,77 @@ module Beaker
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
-
#Determine the PE package to download/upload
|
175
|
+
#Determine the PE package to download/upload on a windows host, download/upload that package onto the host.
|
176
|
+
# @param [Host] host The windows host to download/upload and unpack PE onto
|
177
|
+
# @param [Hash{Symbol=>Symbol, String}] options The options
|
178
|
+
# @option options [String] :pe_dir Default directory or URL to pull PE package from
|
179
|
+
# (Otherwise uses individual hosts pe_dir)
|
180
|
+
# @option options [String] :pe_ver Default PE version to install or upgrade to
|
181
|
+
# (Otherwise uses individual hosts pe_ver)
|
182
|
+
# @option options [String] :pe_ver_win Default PE version to install or upgrade to on Windows hosts
|
183
|
+
# (Otherwise uses individual Windows hosts pe_ver)
|
184
|
+
# @api private
|
185
|
+
def fetch_puppet_on_windows(host, options)
|
186
|
+
path = options[:pe_dir] || host['pe_dir']
|
187
|
+
local = File.directory?(path)
|
188
|
+
version = options[:pe_ver_win] || host['pe_ver']
|
189
|
+
filename = "puppet-enterprise-#{version}"
|
190
|
+
extension = ".msi"
|
191
|
+
if local
|
192
|
+
if not File.exists?("#{path}/#{filename}#{extension}")
|
193
|
+
raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
|
194
|
+
end
|
195
|
+
scp_to host, "#{path}/#{filename}#{extension}", "#{host['working_dir']}/#{filename}#{extension}"
|
196
|
+
else
|
197
|
+
if not link_exists?("#{path}/#{filename}#{extension}")
|
198
|
+
raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
|
199
|
+
end
|
200
|
+
on host, "cd #{host['working_dir']}; curl -O #{path}/#{filename}#{extension}"
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
#Determine the PE package to download/upload on a unix style host, download/upload that package onto the host
|
205
|
+
#and unpack it.
|
206
|
+
# @param [Host] host The unix style host to download/upload and unpack PE onto
|
207
|
+
# @param [Hash{Symbol=>Symbol, String}] options The options
|
208
|
+
# @option options [String] :pe_dir Default directory or URL to pull PE package from
|
209
|
+
# (Otherwise uses individual hosts pe_dir)
|
210
|
+
# @option options [String] :pe_ver Default PE version to install or upgrade to
|
211
|
+
# (Otherwise uses individual hosts pe_ver)
|
212
|
+
# @api private
|
213
|
+
def fetch_puppet_on_unix(host, options)
|
214
|
+
path = options[:pe_dir] || host['pe_dir']
|
215
|
+
local = File.directory?(path)
|
216
|
+
filename = "#{host['dist']}"
|
217
|
+
if local
|
218
|
+
extension = File.exists?("#{path}/#{filename}.tar.gz") ? ".tar.gz" : ".tar"
|
219
|
+
if not File.exists?("#{path}/#{filename}#{extension}")
|
220
|
+
raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
|
221
|
+
end
|
222
|
+
scp_to host, "#{path}/#{filename}#{extension}", "#{host['working_dir']}/#{filename}#{extension}"
|
223
|
+
if extension =~ /gz/
|
224
|
+
on host, "cd #{host['working_dir']}; gunzip #{filename}#{extension}"
|
225
|
+
end
|
226
|
+
if extension =~ /tar/
|
227
|
+
on host, "cd #{host['working_dir']}; tar -xvf #{filename}.tar"
|
228
|
+
end
|
229
|
+
else
|
230
|
+
extension = link_exists?("#{path}/#{filename}.tar.gz") ? ".tar.gz" : ".tar"
|
231
|
+
if not link_exists?("#{path}/#{filename}#{extension}")
|
232
|
+
raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
|
233
|
+
end
|
234
|
+
unpack = 'tar -xvf -'
|
235
|
+
unpack = extension =~ /gz/ ? 'gunzip | ' + unpack : unpack
|
236
|
+
|
237
|
+
on host, "cd #{host['working_dir']}; curl #{path}/#{filename}#{extension} | #{unpack}"
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
#Determine the PE package to download/upload per-host, download/upload that package onto the host
|
176
242
|
#and unpack it.
|
177
|
-
# @param [Array<Host>] hosts The hosts to download/upload and unpack PE onto
|
243
|
+
# @param [Array<Host>] hosts The hosts to download/upload and unpack PE onto
|
178
244
|
# @param [Hash{Symbol=>Symbol, String}] options The options
|
179
|
-
# @option options [String] :pe_dir Default directory or URL to pull PE package from
|
245
|
+
# @option options [String] :pe_dir Default directory or URL to pull PE package from
|
180
246
|
# (Otherwise uses individual hosts pe_dir)
|
181
247
|
# @option options [String] :pe_ver Default PE version to install or upgrade to
|
182
248
|
# (Otherwise uses individual hosts pe_ver)
|
@@ -189,51 +255,10 @@ module Beaker
|
|
189
255
|
next if host['roles'].include? 'frictionless' and ! version_is_less(options[:pe_ver] || host['pe_ver'], '3.2.0')
|
190
256
|
|
191
257
|
windows = host['platform'] =~ /windows/
|
192
|
-
path = options[:pe_dir] || host['pe_dir']
|
193
|
-
local = File.directory?(path)
|
194
|
-
filename = ""
|
195
|
-
extension = ""
|
196
258
|
if windows
|
197
|
-
|
198
|
-
filename = "puppet-enterprise-#{version}"
|
199
|
-
extension = ".msi"
|
259
|
+
fetch_puppet_on_windows(host, options)
|
200
260
|
else
|
201
|
-
|
202
|
-
extension = ""
|
203
|
-
if local
|
204
|
-
extension = File.exists?("#{path}/#{filename}.tar.gz") ? ".tar.gz" : ".tar"
|
205
|
-
else
|
206
|
-
extension = link_exists?("#{path}/#{filename}.tar.gz") ? ".tar.gz" : ".tar"
|
207
|
-
end
|
208
|
-
end
|
209
|
-
if local
|
210
|
-
if not File.exists?("#{path}/#{filename}#{extension}")
|
211
|
-
raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
|
212
|
-
end
|
213
|
-
scp_to host, "#{path}/#{filename}#{extension}", "#{host['working_dir']}/#{filename}#{extension}"
|
214
|
-
if extension =~ /gz/
|
215
|
-
on host, "cd #{host['working_dir']}; gunzip #{filename}#{extension}"
|
216
|
-
end
|
217
|
-
if extension =~ /tar/
|
218
|
-
on host, "cd #{host['working_dir']}; tar -xvf #{filename}.tar"
|
219
|
-
end
|
220
|
-
else
|
221
|
-
if not link_exists?("#{path}/#{filename}#{extension}")
|
222
|
-
raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
|
223
|
-
end
|
224
|
-
gunzip = ""
|
225
|
-
untar = ""
|
226
|
-
save_locally = ""
|
227
|
-
if extension =~ /gz/
|
228
|
-
gunzip = "| gunzip"
|
229
|
-
end
|
230
|
-
if extension =~ /tar/
|
231
|
-
untar = "| tar -xvf -"
|
232
|
-
end
|
233
|
-
if extension =~ /msi/
|
234
|
-
save_locally = "-O"
|
235
|
-
end
|
236
|
-
on host, "cd #{host['working_dir']}; curl #{save_locally} #{path}/#{filename}#{extension} #{gunzip} #{untar}"
|
261
|
+
fetch_puppet_on_unix(host, options)
|
237
262
|
end
|
238
263
|
end
|
239
264
|
end
|
@@ -250,9 +275,9 @@ module Beaker
|
|
250
275
|
end
|
251
276
|
|
252
277
|
#Perform a Puppet Enterprise upgrade or install
|
253
|
-
# @param [Array<Host>] hosts The hosts to install or upgrade PE on
|
278
|
+
# @param [Array<Host>] hosts The hosts to install or upgrade PE on
|
254
279
|
# @param [Hash{Symbol=>Symbol, String}] options The options
|
255
|
-
# @option options [String] :pe_dir Default directory or URL to pull PE package from
|
280
|
+
# @option options [String] :pe_dir Default directory or URL to pull PE package from
|
256
281
|
# (Otherwise uses individual hosts pe_dir)
|
257
282
|
# @option options [String] :pe_ver Default PE version to install or upgrade to
|
258
283
|
# (Otherwise uses individual hosts pe_ver)
|
@@ -260,14 +285,13 @@ module Beaker
|
|
260
285
|
# (Otherwise uses individual Windows hosts pe_ver)
|
261
286
|
# @option options [Symbol] :type (:install) One of :upgrade or :install
|
262
287
|
#
|
263
|
-
#
|
264
|
-
# @example
|
288
|
+
# @example
|
265
289
|
# do_install(hosts, {:type => :upgrade, :pe_dir => path, :pe_ver => version, :pe_ver_win => version_win})
|
266
290
|
#
|
267
291
|
# @api private
|
268
292
|
#
|
269
293
|
def do_install hosts, options = {}
|
270
|
-
options[:type] = options[:type] || :install
|
294
|
+
options[:type] = options[:type] || :install
|
271
295
|
hostcert='uname | grep -i sunos > /dev/null && hostname || hostname -s'
|
272
296
|
master_certname = on(master, hostcert).stdout.strip
|
273
297
|
pre30database = version_is_less(options[:pe_ver] || database['pe_ver'], '3.0')
|
@@ -335,7 +359,7 @@ module Beaker
|
|
335
359
|
if host['pe_ver'] == '3.0.0' and host == database
|
336
360
|
sleep_until_puppetdb_started(database)
|
337
361
|
end
|
338
|
-
end
|
362
|
+
end
|
339
363
|
|
340
364
|
install_hosts.each do |host|
|
341
365
|
wait_for_host_in_dashboard(host)
|
@@ -365,7 +389,7 @@ module Beaker
|
|
365
389
|
b_nums = b.split('-')[0].split('.')
|
366
390
|
(0...a_nums.length).each do |i|
|
367
391
|
if i < b_nums.length
|
368
|
-
if a_nums[i] < b_nums[i]
|
392
|
+
if a_nums[i] < b_nums[i]
|
369
393
|
return true
|
370
394
|
elsif a_nums[i] > b_nums[i]
|
371
395
|
return false
|
@@ -377,7 +401,7 @@ module Beaker
|
|
377
401
|
#checks all dots, they are equal so examine the rest
|
378
402
|
a_rest = a.split('-', 2)[1]
|
379
403
|
b_rest = b.split('-', 2)[1]
|
380
|
-
if a_rest and b_rest and a_rest < b_rest
|
404
|
+
if a_rest and b_rest and a_rest < b_rest
|
381
405
|
return false
|
382
406
|
elsif a_rest and not b_rest
|
383
407
|
return false
|
@@ -388,7 +412,7 @@ module Beaker
|
|
388
412
|
end
|
389
413
|
|
390
414
|
#Sort array of hosts so that it has the correct order for PE installation based upon each host's role
|
391
|
-
# @example
|
415
|
+
# @example
|
392
416
|
# h = sorted_hosts
|
393
417
|
#
|
394
418
|
# @note Order for installation should be
|
@@ -440,7 +464,7 @@ module Beaker
|
|
440
464
|
end
|
441
465
|
|
442
466
|
#Install PE based upon host configuration and options
|
443
|
-
# @example
|
467
|
+
# @example
|
444
468
|
# install_pe
|
445
469
|
#
|
446
470
|
# @note Either pe_ver and pe_dir should be set in the ENV or each host should have pe_ver and pe_dir set individually.
|
@@ -448,23 +472,23 @@ module Beaker
|
|
448
472
|
# for Unix like systems and puppet-enterprise-VERSION.msi for Windows systems.
|
449
473
|
#
|
450
474
|
# @api dsl
|
451
|
-
def install_pe
|
475
|
+
def install_pe
|
452
476
|
#process the version files if necessary
|
453
477
|
hosts.each do |host|
|
454
478
|
host['pe_dir'] ||= options[:pe_dir]
|
455
479
|
if host['platform'] =~ /windows/
|
456
480
|
host['pe_ver'] = host['pe_ver'] || options['pe_ver'] ||
|
457
|
-
Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir], options[:pe_version_file_win])
|
481
|
+
Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir] || options[:pe_dir], options[:pe_version_file_win])
|
458
482
|
else
|
459
483
|
host['pe_ver'] = host['pe_ver'] || options['pe_ver'] ||
|
460
|
-
Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir], options[:pe_version_file])
|
484
|
+
Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir] || options[:pe_dir], options[:pe_version_file])
|
461
485
|
end
|
462
486
|
end
|
463
487
|
do_install sorted_hosts
|
464
488
|
end
|
465
489
|
|
466
490
|
#Upgrade PE based upon host configuration and options
|
467
|
-
# @param [String] path A path (either local directory or a URL to a listing of PE builds).
|
491
|
+
# @param [String] path A path (either local directory or a URL to a listing of PE builds).
|
468
492
|
# Will contain a LATEST file indicating the latest build to install.
|
469
493
|
# This is ignored if a pe_upgrade_ver and pe_upgrade_dir are specified
|
470
494
|
# in the host configuration file.
|
@@ -71,8 +71,9 @@ 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
|
75
|
-
#{HostPrebuiltSteps::UNIX_PACKAGES} on unix platform hosts
|
74
|
+
#install them. Verifies the presence of {HostPrebuiltSteps::PACKAGES} on all hosts,
|
75
|
+
#{HostPrebuiltSteps::UNIX_PACKAGES} on unix platform hosts and {HostPrebuiltSteps::SLES_PACKAGES}
|
76
|
+
#on sles (SUSE, Enterprise Linux) hosts.
|
76
77
|
# @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon
|
77
78
|
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
78
79
|
# @option opts [Beaker::Logger] :logger A {Beaker::Logger} object
|
@@ -93,7 +94,6 @@ module Beaker
|
|
93
94
|
host.install_package pkg
|
94
95
|
end
|
95
96
|
end
|
96
|
-
|
97
97
|
when host['platform'] !~ /(windows)|(aix)|(solaris)/
|
98
98
|
UNIX_PACKAGES.each do |pkg|
|
99
99
|
if not host.check_for_package pkg
|
@@ -326,7 +326,81 @@ module Beaker
|
|
326
326
|
if host['platform'] =~ /windows/
|
327
327
|
host.exec(Command.new('sudo su -c "cp -r .ssh /home/Administrator/."'))
|
328
328
|
else
|
329
|
-
host.exec(Command.new('sudo su -c "cp -r .ssh /root/."'))
|
329
|
+
host.exec(Command.new('sudo su -c "cp -r .ssh /root/."'), {:pty => true})
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
#Update /etc/hosts to make it possible for each provided host to reach each other host by name.
|
335
|
+
#Assumes that each provided host has host[:ip] set.
|
336
|
+
# @param [Host, Array<Host>, String, Symbol] hosts An array of hosts to act upon
|
337
|
+
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
338
|
+
# @option opts [Beaker::Logger] :logger A {Beaker::Logger} object
|
339
|
+
def hack_etc_hosts hosts, opts
|
340
|
+
etc_hosts = "127.0.0.1\tlocalhost localhost.localdomain\n"
|
341
|
+
hosts.each do |host|
|
342
|
+
etc_hosts += "#{host['ip'].to_s}\t#{host[:vmhostname] || host.name}\n"
|
343
|
+
end
|
344
|
+
hosts.each do |host|
|
345
|
+
set_etc_hosts(host, etc_hosts)
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
#Update sshd_config on debian, ubuntu, centos, el, redhat and fedora boxes to allow for root login, does nothing on other platfoms
|
350
|
+
# @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon
|
351
|
+
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
352
|
+
# @option opts [Beaker::Logger] :logger A {Beaker::Logger} object
|
353
|
+
def enable_root_login host, opts
|
354
|
+
logger = opts[:logger]
|
355
|
+
if host.is_a? Array
|
356
|
+
host.map { |h| copy_ssh_to_root(h, opts) }
|
357
|
+
else
|
358
|
+
logger.debug "Update /etc/ssh/sshd_config to allow root login"
|
359
|
+
host.exec(Command.new("sudo su -c \"sed -i 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config\""), {:pty => true}
|
360
|
+
)
|
361
|
+
#restart sshd
|
362
|
+
if host['platform'] =~ /debian|ubuntu/
|
363
|
+
host.exec(Command.new("sudo su -c \"service ssh restart\""), {:pty => true})
|
364
|
+
elsif host['platform'] =~ /centos|el-|redhat|fedora/
|
365
|
+
host.exec(Command.new("sudo su -c \"service sshd restart\""), {:pty => true})
|
366
|
+
else
|
367
|
+
@logger.warn("Attempting to update ssh on non-supported platform: #{host.name}: #{host['platform']}")
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
#Disable SELinux on centos, does nothing on other platforms
|
373
|
+
# @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon
|
374
|
+
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
375
|
+
# @option opts [Beaker::Logger] :logger A {Beaker::Logger} object
|
376
|
+
def disable_se_linux host, opts
|
377
|
+
logger = opts[:logger]
|
378
|
+
if host.is_a? Array
|
379
|
+
host.map { |h| copy_ssh_to_root(h, opts) }
|
380
|
+
else
|
381
|
+
if host['platform'] =~ /centos/
|
382
|
+
@logger.debug("Disabling se_linux on #{host.name}")
|
383
|
+
host.exec(Command.new("sudo su -c \"setenforce 0\""), {:pty => true})
|
384
|
+
else
|
385
|
+
@logger.warn("Attempting to disable SELinux on non-centos platform: #{host.name}: #{host['platform']}")
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
#Disable iptables on centos, does nothing on other platforms
|
391
|
+
# @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon
|
392
|
+
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
393
|
+
# @option opts [Beaker::Logger] :logger A {Beaker::Logger} object
|
394
|
+
def disable_iptables host, opts
|
395
|
+
logger = opts[:logger]
|
396
|
+
if host.is_a? Array
|
397
|
+
host.map { |h| copy_ssh_to_root(h, opts) }
|
398
|
+
else
|
399
|
+
if host['platform'] =~ /centos/
|
400
|
+
logger.debug("Disabling iptables on #{host.name}")
|
401
|
+
host.exec(Command.new("sudo su -c \"/etc/init.d/iptables stop\""), {:pty => true})
|
402
|
+
else
|
403
|
+
logger.warn("Attempting to disable iptables on non-centos platform: #{host.name}: #{host['platform']}")
|
330
404
|
end
|
331
405
|
end
|
332
406
|
end
|
data/lib/beaker/hypervisor.rb
CHANGED
@@ -11,6 +11,9 @@ module Beaker
|
|
11
11
|
class Hypervisor
|
12
12
|
include HostPrebuiltSteps
|
13
13
|
|
14
|
+
#Generates an array with all letters a thru z and numbers 0 thru 9
|
15
|
+
CHARMAP = ('a'..'z').to_a + ('0'..'9').to_a
|
16
|
+
|
14
17
|
#Hypervisor creator method. Creates the appropriate hypervisor class object based upon
|
15
18
|
#the provided hypervisor type selected, then provisions hosts with hypervisor.
|
16
19
|
#@param [String] type The type of hypervisor to create - one of aix, solaris, vsphere, fusion,
|
@@ -39,6 +42,8 @@ module Beaker
|
|
39
42
|
end
|
40
43
|
when /vagrant/
|
41
44
|
Beaker::Vagrant
|
45
|
+
when /google/
|
46
|
+
Beaker::GoogleCompute
|
42
47
|
when /none/
|
43
48
|
Beaker::Hypervisor
|
44
49
|
else
|
@@ -80,17 +85,22 @@ module Beaker
|
|
80
85
|
if @options[:add_master_entry]
|
81
86
|
add_master_entry(@hosts, @options)
|
82
87
|
end
|
83
|
-
|
88
|
+
end
|
84
89
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
90
|
+
#Default validation steps to be run for a given hypervisor
|
91
|
+
def validate
|
92
|
+
validate_host(@hosts, @options)
|
93
|
+
end
|
94
|
+
|
95
|
+
#Generate a random straing composted of letter and numbers
|
96
|
+
def generate_host_name
|
97
|
+
CHARMAP[rand(25)] + (0...14).map{CHARMAP[rand(CHARMAP.length)]}.join
|
98
|
+
end
|
89
99
|
|
90
100
|
end
|
91
101
|
end
|
92
102
|
|
93
|
-
%w( vsphere_helper vagrant fusion blimper vsphere vcloud vcloud_pooled aixer solaris).each do |lib|
|
103
|
+
%w( vsphere_helper vagrant fusion blimper vsphere vcloud vcloud_pooled aixer solaris google_compute_helper google_compute).each do |lib|
|
94
104
|
begin
|
95
105
|
require "hypervisor/#{lib}"
|
96
106
|
rescue LoadError
|