beaker 2.13.0 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +19 -0
- data/HISTORY.md +335 -2
- data/acceptance/pre_suite/puppet_git/install.rb +2 -2
- data/lib/beaker/answers.rb +45 -2
- data/lib/beaker/answers/version20.rb +9 -9
- data/lib/beaker/answers/version28.rb +9 -9
- data/lib/beaker/answers/version30.rb +19 -19
- data/lib/beaker/answers/version32.rb +1 -1
- data/lib/beaker/answers/version34.rb +4 -4
- data/lib/beaker/answers/version40.rb +1 -1
- data/lib/beaker/cli.rb +11 -4
- data/lib/beaker/command.rb +4 -2
- data/lib/beaker/command_factory.rb +5 -1
- data/lib/beaker/dsl/helpers/host_helpers.rb +17 -5
- data/lib/beaker/dsl/install_utils.rb +3 -2
- data/lib/beaker/dsl/install_utils/aio_defaults.rb +86 -0
- data/lib/beaker/dsl/install_utils/foss_defaults.rb +163 -0
- data/lib/beaker/dsl/install_utils/foss_utils.rb +988 -0
- data/lib/beaker/dsl/install_utils/pe_defaults.rb +139 -0
- data/lib/beaker/dsl/install_utils/pe_utils.rb +140 -38
- data/lib/beaker/dsl/install_utils/puppet_utils.rb +26 -751
- data/lib/beaker/dsl/structure.rb +7 -1
- data/lib/beaker/host.rb +35 -58
- data/lib/beaker/host/freebsd.rb +4 -16
- data/lib/beaker/host/mac.rb +3 -39
- data/lib/beaker/host/mac/pkg.rb +2 -1
- data/lib/beaker/host/pswindows.rb +2 -28
- data/lib/beaker/host/unix.rb +3 -51
- data/lib/beaker/host/unix/pkg.rb +34 -33
- data/lib/beaker/host/windows.rb +1 -45
- data/lib/beaker/host_prebuilt_steps.rb +11 -24
- data/lib/beaker/hypervisor/aixer.rb +1 -1
- data/lib/beaker/hypervisor/docker.rb +43 -4
- data/lib/beaker/hypervisor/openstack.rb +1 -0
- data/lib/beaker/hypervisor/solaris.rb +1 -1
- data/lib/beaker/hypervisor/vmpooler.rb +19 -8
- data/lib/beaker/network_manager.rb +5 -4
- data/lib/beaker/options/command_line_parser.rb +9 -9
- data/lib/beaker/options/parser.rb +21 -17
- data/lib/beaker/options/presets.rb +0 -33
- data/lib/beaker/platform.rb +7 -3
- data/lib/beaker/ssh_connection.rb +1 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/answers_spec.rb +13 -8
- data/spec/beaker/cli_spec.rb +6 -6
- data/spec/beaker/command_spec.rb +18 -0
- data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +2 -0
- data/spec/beaker/dsl/install_utils/{puppet_utils_spec.rb → foss_utils_spec.rb} +34 -21
- data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +2 -0
- data/spec/beaker/dsl/structure_spec.rb +8 -0
- data/spec/beaker/host/unix/pkg_spec.rb +15 -10
- data/spec/beaker/host_prebuilt_steps_spec.rb +1 -1
- data/spec/beaker/host_spec.rb +3 -54
- data/spec/beaker/hypervisor/docker_spec.rb +2 -0
- data/spec/beaker/hypervisor/vmpooler_spec.rb +67 -10
- data/spec/beaker/options/command_line_parser_spec.rb +2 -2
- data/spec/beaker/options/parser_spec.rb +35 -24
- data/spec/beaker/options/presets_spec.rb +0 -26
- data/spec/helpers.rb +5 -5
- data/spec/mocks.rb +1 -2
- metadata +7 -3
data/lib/beaker/host/windows.rb
CHANGED
@@ -15,58 +15,14 @@ module Windows
|
|
15
15
|
include Windows::Exec
|
16
16
|
include Windows::Pkg
|
17
17
|
|
18
|
-
def
|
18
|
+
def platform_defaults
|
19
19
|
h = Beaker::Options::OptionsHash.new
|
20
20
|
h.merge({
|
21
21
|
'user' => 'Administrator',
|
22
22
|
'group' => 'Administrators',
|
23
|
-
'puppetservice' => 'pe-httpd',
|
24
|
-
'puppetpath' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
|
25
|
-
'puppetconfdir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
|
26
|
-
'puppetcodedir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
|
27
|
-
'hieraconf' => '`cygpath -smF 35`/Puppetlabs/puppet/etc/hiera.yaml',
|
28
|
-
'puppetvardir' => '`cygpath -smF 35`/PuppetLabs/puppet/var',
|
29
|
-
'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc/modules',
|
30
|
-
'sitemoduledir' => 'C:/usr/share/puppet/modules',
|
31
|
-
#let's just add both potential bin dirs to the path
|
32
|
-
'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet Enterprise/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet Enterprise/bin',
|
33
|
-
'privatebindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet Enterprise/sys/ruby/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/bin',
|
34
23
|
'pathseparator' => ';',
|
35
24
|
})
|
36
25
|
end
|
37
26
|
|
38
|
-
def self.foss_defaults
|
39
|
-
h = Beaker::Options::OptionsHash.new
|
40
|
-
h.merge({
|
41
|
-
'user' => 'Administrator',
|
42
|
-
'group' => 'Administrators',
|
43
|
-
'puppetpath' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
|
44
|
-
'puppetconfdir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
|
45
|
-
'puppetcodedir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
|
46
|
-
'hieraconf' => '`cygpath -smF 35`/Puppetlabs/puppet/etc/hiera.yaml',
|
47
|
-
'puppetvardir' => '`cygpath -smF 35`/PuppetLabs/puppet/var',
|
48
|
-
'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc/modules',
|
49
|
-
'sitemoduledir' => 'C:/usr/share/puppet/modules',
|
50
|
-
'hieralibdir' => '`cygpath -w /opt/puppet-git-repos/hiera/lib`',
|
51
|
-
'hierapuppetlibdir' => '`cygpath -w /opt/puppet-git-repos/hiera-puppet/lib`',
|
52
|
-
#let's just add both potential bin dirs to the path
|
53
|
-
'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/bin',
|
54
|
-
'privatebindir' => '/usr/bin',
|
55
|
-
'hierabindir' => '/opt/puppet-git-repos/hiera/bin',
|
56
|
-
'pathseparator' => ';',
|
57
|
-
})
|
58
|
-
end
|
59
|
-
|
60
|
-
def self.aio_defaults
|
61
|
-
h = Beaker::Options::OptionsHash.new
|
62
|
-
h.merge({
|
63
|
-
'user' => 'Administrator',
|
64
|
-
'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/bin',
|
65
|
-
'privatebindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/sys/ruby/bin',
|
66
|
-
'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/code/modules',
|
67
|
-
# sitemoduledir not included (check PUP-4049 for more info)
|
68
|
-
'pathseparator' => ';',
|
69
|
-
})
|
70
|
-
end
|
71
27
|
end
|
72
28
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
|
3
|
-
[ 'command', "dsl
|
3
|
+
[ 'command', "dsl" ].each do |lib|
|
4
4
|
require "beaker/#{lib}"
|
5
5
|
end
|
6
6
|
|
@@ -456,18 +456,6 @@ module Beaker
|
|
456
456
|
merged_hash
|
457
457
|
end
|
458
458
|
|
459
|
-
# 'echo' the provided value on the given host
|
460
|
-
# @param [Host] host The host to execute the 'echo' on
|
461
|
-
# @param [String] val The string to 'echo' on the host
|
462
|
-
def echo_on_host host, val
|
463
|
-
#val = val.gsub(/"/, "\"").gsub(/\(/, "\(")
|
464
|
-
if host.is_powershell?
|
465
|
-
host.exec(Command.new("echo #{val}")).stdout.chomp
|
466
|
-
else
|
467
|
-
host.exec(Command.new("echo \"#{val}\"")).stdout.chomp
|
468
|
-
end
|
469
|
-
end
|
470
|
-
|
471
459
|
# Create the hash of default environment from host (:host_env), global options hash (:host_env) and default PE/Foss puppet variables
|
472
460
|
# @param [Host] host The host to construct the environment hash for, host specific environment should be in :host_env in a hash
|
473
461
|
# @param [Hash] opts Hash of options, including optional global host_env to be applied to each provided host
|
@@ -475,17 +463,6 @@ module Beaker
|
|
475
463
|
def construct_env host, opts
|
476
464
|
env = additive_hash_merge(host[:host_env], opts[:host_env])
|
477
465
|
|
478
|
-
#Add PATH
|
479
|
-
|
480
|
-
#prepend any PATH already set for this host
|
481
|
-
|
482
|
-
env['PATH'] = (%w(puppetbindir facterbindir hierabindir) << env['PATH']).compact.reject(&:empty?)
|
483
|
-
#get the PATH defaults
|
484
|
-
env['PATH'].map! { |val| host[val] }
|
485
|
-
env['PATH'] = env['PATH'].compact.reject(&:empty?)
|
486
|
-
#run the paths through echo to see if they have any subcommands that need processing
|
487
|
-
env['PATH'].map! { |val| echo_on_host(host, val) }
|
488
|
-
|
489
466
|
env.each_key do |key|
|
490
467
|
separator = host['pathseparator']
|
491
468
|
if key == 'PATH' && (not host.is_powershell?)
|
@@ -560,6 +537,16 @@ module Beaker
|
|
560
537
|
env.each_pair do |var, value|
|
561
538
|
host.add_env_var(var, value)
|
562
539
|
end
|
540
|
+
# REMOVE POST BEAKER 3: backwards compatability, do some setup based upon the global type
|
541
|
+
# this is the worst and i hate it
|
542
|
+
if host[:type]
|
543
|
+
case host[:type]
|
544
|
+
when /git|foss|aio/
|
545
|
+
Class.new.extend(Beaker::DSL).configure_foss_defaults_on(host)
|
546
|
+
when /pe/
|
547
|
+
Class.new.extend(Beaker::DSL).configure_pe_defaults_on(host)
|
548
|
+
end
|
549
|
+
end
|
563
550
|
|
564
551
|
#close the host to re-establish the connection with the new sshd settings
|
565
552
|
host.close
|
@@ -23,7 +23,7 @@ module Beaker
|
|
23
23
|
}
|
24
24
|
|
25
25
|
@logger.notify "Connecting to hypervisor at #{hypername}"
|
26
|
-
hypervisor = Beaker::Host.create( hypername, hyperopts )
|
26
|
+
hypervisor = Beaker::Host.create( hypername, hyperopts, @options )
|
27
27
|
hypervisor[:user] = @fog_file[:default][:aix_hypervisor_username] || hypervisor[:user]
|
28
28
|
hypervisor[:ssh][:keys] = [@fog_file[:default][:aix_hypervisor_keyfile]] || hypervisor[:ssh][:keys]
|
29
29
|
|
@@ -1,6 +1,13 @@
|
|
1
1
|
module Beaker
|
2
2
|
class Docker < Beaker::Hypervisor
|
3
3
|
|
4
|
+
# Docker hypvervisor initializtion
|
5
|
+
# Env variables supported:
|
6
|
+
# DOCKER_REGISTRY: Docker registry URL
|
7
|
+
# DOCKER_HOST: Remote docker host
|
8
|
+
# @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
|
9
|
+
# or a role (String or Symbol) that identifies one or more hosts.
|
10
|
+
# @param [Hash{Symbol=>String}] options Options to pass on to the hypervisor
|
4
11
|
def initialize(hosts, options)
|
5
12
|
require 'docker'
|
6
13
|
@options = options
|
@@ -21,6 +28,19 @@ module Beaker
|
|
21
28
|
|
22
29
|
# Pass on all the logging from docker-api to the beaker logger instance
|
23
30
|
::Docker.logger = @logger
|
31
|
+
|
32
|
+
# Find out what kind of remote instance we are talking against
|
33
|
+
if ::Docker.version['Version'] =~ /swarm/
|
34
|
+
@docker_type = 'swarm'
|
35
|
+
unless ENV['DOCKER_REGISTRY']
|
36
|
+
raise "Using Swarm with beaker requires a private registry. Please setup the private registry and set the 'DOCKER_REGISTRY' env var"
|
37
|
+
else
|
38
|
+
@registry = ENV['DOCKER_REGISTRY']
|
39
|
+
end
|
40
|
+
else
|
41
|
+
@docker_type = 'docker'
|
42
|
+
end
|
43
|
+
|
24
44
|
end
|
25
45
|
|
26
46
|
def provision
|
@@ -32,9 +52,21 @@ module Beaker
|
|
32
52
|
@logger.debug("Creating image")
|
33
53
|
image = ::Docker::Image.build(dockerfile_for(host), { :rm => true })
|
34
54
|
|
35
|
-
@
|
55
|
+
if @docker_type == 'swarm'
|
56
|
+
image_name = "#{@registry}/beaker/#{image.id}"
|
57
|
+
ret = ::Docker::Image.search(:term => image_name)
|
58
|
+
if ret.first.nil?
|
59
|
+
@logger.debug("Image does not exist on registry. Pushing.")
|
60
|
+
image.tag({:repo => image_name, :force => true})
|
61
|
+
image.push
|
62
|
+
end
|
63
|
+
else
|
64
|
+
image_name = image.id
|
65
|
+
end
|
66
|
+
|
67
|
+
@logger.debug("Creating container from image #{image_name}")
|
36
68
|
container = ::Docker::Container.create({
|
37
|
-
'Image' =>
|
69
|
+
'Image' => image_name,
|
38
70
|
'Hostname' => host.name,
|
39
71
|
})
|
40
72
|
|
@@ -42,12 +74,19 @@ module Beaker
|
|
42
74
|
container.start({"PublishAllPorts" => true, "Privileged" => true})
|
43
75
|
|
44
76
|
# Find out where the ssh port is from the container
|
45
|
-
|
77
|
+
# When running on swarm DOCKER_HOST points to the swarm manager so we have to get the
|
78
|
+
# IP of the swarm slave via the container data
|
79
|
+
# When we are talking to a normal docker instance DOCKER_HOST can point to a remote docker instance.
|
80
|
+
|
81
|
+
# Talking against a remote docker host which is a normal docker host
|
82
|
+
if @docker_type == 'docker' && ENV['DOCKER_HOST']
|
46
83
|
ip = URI.parse(ENV['DOCKER_HOST']).host
|
47
|
-
@logger.info("Using docker server at #{ip}")
|
48
84
|
else
|
85
|
+
# Swarm or local docker host
|
49
86
|
ip = container.json["NetworkSettings"]["Ports"]["22/tcp"][0]["HostIp"]
|
50
87
|
end
|
88
|
+
|
89
|
+
@logger.info("Using docker server at #{ip}")
|
51
90
|
port = container.json["NetworkSettings"]["Ports"]["22/tcp"][0]["HostPort"]
|
52
91
|
|
53
92
|
forward_ssh_agent = @options[:forward_ssh_agent] || false
|
@@ -100,6 +100,7 @@ module Beaker
|
|
100
100
|
:image_ref => image(host[:image]).id,
|
101
101
|
:nics => [ {'net_id' => network(@options[:openstack_network]).id } ],
|
102
102
|
:name => host[:vmhostname],
|
103
|
+
:user_data => "#cloud-config\nmanage_etc_hosts: true\n",
|
103
104
|
}
|
104
105
|
options[:key_name] = key_name(host)
|
105
106
|
vm = @compute_client.servers.create(options)
|
@@ -24,7 +24,7 @@ module Beaker
|
|
24
24
|
}
|
25
25
|
|
26
26
|
@logger.notify "Connecting to hypervisor at #{hypername}"
|
27
|
-
hypervisor = Beaker::Host.create( hypername, hyperopts )
|
27
|
+
hypervisor = Beaker::Host.create( hypername, hyperopts, @options )
|
28
28
|
hypervisor[:user] = @fog_file[:default][:solaris_hypervisor_username] || hypervisor[:user]
|
29
29
|
hypervisor[:ssh][:keys] = [@fog_file[:default][:solaris_hypervisor_keyfile]] || hypervisor[:ssh][:keys]
|
30
30
|
|
@@ -15,6 +15,8 @@ module Beaker
|
|
15
15
|
Errno::ENETUNREACH,
|
16
16
|
]
|
17
17
|
|
18
|
+
attr_reader :options, :logger, :hosts, :credentials
|
19
|
+
|
18
20
|
def initialize(vmpooler_hosts, options)
|
19
21
|
@options = options
|
20
22
|
@logger = options[:logger]
|
@@ -25,16 +27,25 @@ module Beaker
|
|
25
27
|
def load_credentials(dot_fog = '.fog')
|
26
28
|
creds = {}
|
27
29
|
|
28
|
-
|
29
|
-
fog
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
if fog = read_fog_file(dot_fog)
|
31
|
+
if fog[:default] && fog[:default][:vmpooler_token]
|
32
|
+
creds[:vmpooler_token] = fog[:default][:vmpooler_token]
|
33
|
+
else
|
34
|
+
@logger.warn "Credentials file (#{dot_fog}) is missing a :default section with a :vmpooler_token value; proceeding without authentication"
|
35
|
+
end
|
36
|
+
else
|
37
|
+
@logger.warn "Credentials file (#{dot_fog}) is empty; proceeding without authentication"
|
35
38
|
end
|
36
39
|
|
37
40
|
creds
|
41
|
+
|
42
|
+
rescue Errno::ENOENT
|
43
|
+
@logger.warn "Credentials file (#{dot_fog}) not found; proceeding without authentication"
|
44
|
+
creds
|
45
|
+
end
|
46
|
+
|
47
|
+
def read_fog_file(dot_fog = '.fog')
|
48
|
+
YAML.load_file(dot_fog)
|
38
49
|
end
|
39
50
|
|
40
51
|
def check_url url
|
@@ -149,7 +160,7 @@ module Beaker
|
|
149
160
|
request.body = { 'tags' => tags }.to_json
|
150
161
|
|
151
162
|
response = http.request(request)
|
152
|
-
rescue RuntimeError,
|
163
|
+
rescue RuntimeError, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
153
164
|
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, *SSH_EXCEPTIONS => e
|
154
165
|
@logger.notify "Failed to connect to vmpooler for tagging!"
|
155
166
|
end
|
@@ -50,13 +50,14 @@ module Beaker
|
|
50
50
|
end
|
51
51
|
@hypervisors = {}
|
52
52
|
#sort hosts by their hypervisor, use hypervisor 'none' if no hypervisor is specified
|
53
|
+
hostless_options = Beaker::Options::OptionsHash.new.merge(@options.select{ |k,v| k.to_s !~ /HOSTS/})
|
53
54
|
@options['HOSTS'].each_key do |name|
|
54
|
-
|
55
|
-
hypervisor =
|
56
|
-
hypervisor = provision?(@options,
|
55
|
+
host_hash = @options['HOSTS'][name]
|
56
|
+
hypervisor = host_hash['hypervisor']
|
57
|
+
hypervisor = provision?(@options, host_hash) ? host_hash['hypervisor'] : 'none'
|
57
58
|
@logger.debug "Hypervisor for #{name} is #{hypervisor}"
|
58
59
|
@machines[hypervisor] = [] unless @machines[hypervisor]
|
59
|
-
@machines[hypervisor] << Beaker::Host.create(name,
|
60
|
+
@machines[hypervisor] << Beaker::Host.create(name, host_hash, hostless_options)
|
60
61
|
end
|
61
62
|
|
62
63
|
@machines.each_key do |type|
|
@@ -27,13 +27,6 @@ module Beaker
|
|
27
27
|
@cmd_options[:options_file] = file
|
28
28
|
end
|
29
29
|
|
30
|
-
opts.on '--type TYPE',
|
31
|
-
'one of git, foss, or pe',
|
32
|
-
'used to determine underlying path structure of puppet install',
|
33
|
-
'(default pe)' do |type|
|
34
|
-
@cmd_options[:type] = type
|
35
|
-
end
|
36
|
-
|
37
30
|
opts.on '--helper PATH/TO/SCRIPT',
|
38
31
|
'Ruby file evaluated prior to tests',
|
39
32
|
'(a la spec_helper)' do |script|
|
@@ -193,6 +186,10 @@ module Beaker
|
|
193
186
|
@cmd_options[:validate] = bool
|
194
187
|
end
|
195
188
|
|
189
|
+
opts.on '--collect-perf-data', 'Use sysstat on linux hosts to collect performance and load data' do
|
190
|
+
@cmd_options[:collect_perf_data] = true
|
191
|
+
end
|
192
|
+
|
196
193
|
opts.on('--version', 'Report currently running version of beaker' ) do
|
197
194
|
@cmd_options[:version] = true
|
198
195
|
end
|
@@ -220,9 +217,12 @@ module Beaker
|
|
220
217
|
#noop
|
221
218
|
end
|
222
219
|
|
223
|
-
opts.on '--
|
224
|
-
|
220
|
+
opts.on '--type TYPE',
|
221
|
+
'DEPRECATED - pe/foss/aio determined during runtime' do |type|
|
222
|
+
#backwards compatability, oh how i hate you
|
223
|
+
@cmd_options[:type] = type
|
225
224
|
end
|
225
|
+
|
226
226
|
end
|
227
227
|
|
228
228
|
end
|
@@ -169,9 +169,9 @@ module Beaker
|
|
169
169
|
#
|
170
170
|
# Order of priority is as follows:
|
171
171
|
# 1. environment variables are given top priority
|
172
|
-
# 2.
|
173
|
-
# 3.
|
174
|
-
# 4.
|
172
|
+
# 2. ARGV or provided arguments array
|
173
|
+
# 3. host file options
|
174
|
+
# 4. the 'CONFIG' section of the hosts file
|
175
175
|
# 5. options file values
|
176
176
|
# 6. default or preset values are given the lowest priority
|
177
177
|
#
|
@@ -184,6 +184,7 @@ module Beaker
|
|
184
184
|
|
185
185
|
@options = @presets.presets
|
186
186
|
cmd_line_options = @command_line_parser.parse(args)
|
187
|
+
cmd_line_options[:command_line] = ([$0] + args).join(' ')
|
187
188
|
file_options = Beaker::Options::OptionsFileParser.parse_options_file(cmd_line_options[:options_file])
|
188
189
|
|
189
190
|
# merge together command line and file_options
|
@@ -193,16 +194,19 @@ module Beaker
|
|
193
194
|
# merge command line and file options with defaults
|
194
195
|
# overwrite defaults with command line and file options
|
195
196
|
@options = @options.merge(cmd_line_and_file_options)
|
196
|
-
@options[:command_line] = ([$0] + args).join(' ')
|
197
197
|
|
198
198
|
if not @options[:help] and not @options[:version]
|
199
199
|
#read the hosts file that contains the node configuration and hypervisor info
|
200
200
|
hosts_options = Beaker::Options::HostsFileParser.parse_hosts_file(@options[:hosts_file])
|
201
201
|
|
202
202
|
# merge in host file vars
|
203
|
-
# overwrite options (default, file options, command line
|
203
|
+
# overwrite options (default, file options, command line) with host file options
|
204
204
|
@options = @options.merge(hosts_options)
|
205
205
|
|
206
|
+
# re-merge the command line options
|
207
|
+
# overwrite options (default, file options, hosts file ) with command line arguments
|
208
|
+
@options = @options.merge(cmd_line_options)
|
209
|
+
|
206
210
|
# merge in env vars
|
207
211
|
# overwrite options (default, file options, command line, hosts file) with env
|
208
212
|
env_vars = @presets.env_vars
|
@@ -236,14 +240,13 @@ module Beaker
|
|
236
240
|
# - each host has a valid platform
|
237
241
|
# - if a keyfile is provided then use it
|
238
242
|
# - paths provided to --test, --pre-suite, --post-suite provided lists of .rb files for testing
|
239
|
-
# - --type is one of 'pe' or 'git'
|
240
243
|
# - --fail-mode is one of 'fast', 'stop' or nil
|
241
244
|
# - if using blimpy hypervisor an EC2 YAML file exists
|
242
245
|
# - if using the aix, solaris, or vcloud hypervisors a .fog file exists
|
243
246
|
# - that one and only one master is defined per set of hosts
|
244
247
|
# - that solaris/windows/aix hosts are agent only for PE tests OR
|
245
|
-
# - that windows/aix host are agent only if type is not 'pe'
|
246
248
|
# - sets the default host based upon machine definitions
|
249
|
+
# - if an ssh user has been defined make it the host user
|
247
250
|
#
|
248
251
|
#@raise [ArgumentError] Raise if argument/options values are invalid
|
249
252
|
def normalize_args
|
@@ -266,7 +269,7 @@ module Beaker
|
|
266
269
|
LONG_OPTS.each do |opt|
|
267
270
|
if @options.has_key?(opt)
|
268
271
|
@options[opt] = split_arg(@options[opt])
|
269
|
-
if RB_FILE_OPTS.include?(opt)
|
272
|
+
if RB_FILE_OPTS.include?(opt) && (not @options[opt] == [])
|
270
273
|
@options[opt] = file_list(@options[opt])
|
271
274
|
end
|
272
275
|
if opt == :install
|
@@ -277,11 +280,6 @@ module Beaker
|
|
277
280
|
end
|
278
281
|
end
|
279
282
|
|
280
|
-
#check for valid type
|
281
|
-
if @options[:type] !~ /pe|git|foss|aio/
|
282
|
-
parser_error "--type must be one of pe, git, foss, or aio not '#{@options[:type]}'"
|
283
|
-
end
|
284
|
-
|
285
283
|
#check for valid fail mode
|
286
284
|
if @options[:fail_mode] !~ /stop|fast|slow/
|
287
285
|
parser_error "--fail-mode must be one of fast or slow, not '#{@options[:fail_mode]}'"
|
@@ -326,12 +324,10 @@ module Beaker
|
|
326
324
|
parser_error "Only one host/node may have the role 'master', fix #{@options[:hosts_file]}"
|
327
325
|
end
|
328
326
|
|
329
|
-
#check that
|
327
|
+
#check that windows/el-4 boxes are only agents (solaris can be a master in foss cases)
|
330
328
|
@options[:HOSTS].each_key do |name|
|
331
329
|
host = @options[:HOSTS][name]
|
332
|
-
if
|
333
|
-
(@options.is_pe? && host[:platform] =~ /solaris/)
|
334
|
-
|
330
|
+
if host[:platform] =~ /windows|el-4/
|
335
331
|
test_host_roles(name, host)
|
336
332
|
end
|
337
333
|
end
|
@@ -339,6 +335,14 @@ module Beaker
|
|
339
335
|
#set the default role
|
340
336
|
set_default_host!(@options[:HOSTS])
|
341
337
|
|
338
|
+
#check to see if a custom user account has been provided, if so use it
|
339
|
+
@options[:HOSTS].each_key do |name|
|
340
|
+
host = @options[:HOSTS][name]
|
341
|
+
if host[:ssh] && host[:ssh][:user]
|
342
|
+
host[:user] = host[:ssh][:user]
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
342
346
|
end
|
343
347
|
|
344
348
|
private
|
@@ -165,39 +165,6 @@ module Beaker
|
|
165
165
|
:host_env => {},
|
166
166
|
:ssh_env_file => '~/.ssh/environment',
|
167
167
|
:profile_d_env_file => '/etc/profile.d/beaker_env.sh',
|
168
|
-
:answers => {
|
169
|
-
:q_puppet_enterpriseconsole_auth_user_email => 'admin@example.com',
|
170
|
-
:q_puppet_enterpriseconsole_auth_password => '~!@#$%^*-/ aZ',
|
171
|
-
:q_puppet_enterpriseconsole_smtp_port => 25,
|
172
|
-
:q_puppet_enterpriseconsole_smtp_use_tls => 'n',
|
173
|
-
:q_verify_packages => 'y',
|
174
|
-
:q_puppetdb_password => '~!@#$%^*-/ aZ',
|
175
|
-
:q_puppetmaster_enterpriseconsole_port => 443,
|
176
|
-
:q_puppet_enterpriseconsole_auth_database_name => 'console_auth',
|
177
|
-
:q_puppet_enterpriseconsole_auth_database_user => 'mYu7hu3r',
|
178
|
-
:q_puppet_enterpriseconsole_database_name => 'console',
|
179
|
-
:q_puppet_enterpriseconsole_database_user => 'mYc0nS03u3r',
|
180
|
-
:q_database_root_password => '=ZYdjiP3jCwV5eo9s1MBd',
|
181
|
-
:q_database_root_user => 'pe-postgres',
|
182
|
-
:q_database_export_dir => '/tmp',
|
183
|
-
:q_puppetdb_database_name => 'pe-puppetdb',
|
184
|
-
:q_puppetdb_database_user => 'mYpdBu3r',
|
185
|
-
:q_database_port => 5432,
|
186
|
-
:q_puppetdb_port => 8081,
|
187
|
-
:q_classifier_database_user => 'DFGhjlkj',
|
188
|
-
:q_database_name => 'pe-classifier',
|
189
|
-
:q_classifier_database_password => '~!@#$%^*-/ aZ',
|
190
|
-
:q_activity_database_user => 'adsfglkj',
|
191
|
-
:q_activity_database_name => 'pe-activity',
|
192
|
-
:q_activity_database_password => '~!@#$%^*-/ aZ',
|
193
|
-
:q_rbac_database_user => 'RbhNBklm',
|
194
|
-
:q_rbac_database_name => 'pe-rbac',
|
195
|
-
:q_rbac_database_password => '~!@#$%^*-/ aZ',
|
196
|
-
:q_install_update_server => 'y',
|
197
|
-
:q_exit_for_nc_migrate => 'n',
|
198
|
-
:q_enable_future_parser => 'n',
|
199
|
-
:q_pe_check_for_updates => 'n',
|
200
|
-
},
|
201
168
|
:dot_fog => File.join(ENV['HOME'], '.fog'),
|
202
169
|
:ec2_yaml => 'config/image_templates/ec2.yaml',
|
203
170
|
:help => false,
|