beaker 2.7.1 → 2.8.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 +121 -2
  3. data/lib/beaker/dsl.rb +2 -2
  4. data/lib/beaker/dsl/helpers.rb +13 -1429
  5. data/lib/beaker/dsl/helpers/facter_helpers.rb +48 -0
  6. data/lib/beaker/dsl/helpers/hiera_helpers.rb +71 -0
  7. data/lib/beaker/dsl/helpers/host_helpers.rb +506 -0
  8. data/lib/beaker/dsl/helpers/puppet_helpers.rb +698 -0
  9. data/lib/beaker/dsl/helpers/tk_helpers.rb +101 -0
  10. data/lib/beaker/dsl/helpers/web_helpers.rb +115 -0
  11. data/lib/beaker/dsl/install_utils.rb +8 -1570
  12. data/lib/beaker/dsl/install_utils/ezbake_utils.rb +256 -0
  13. data/lib/beaker/dsl/install_utils/module_utils.rb +237 -0
  14. data/lib/beaker/dsl/install_utils/pe_utils.rb +518 -0
  15. data/lib/beaker/dsl/install_utils/puppet_utils.rb +722 -0
  16. data/lib/beaker/dsl/outcomes.rb +0 -4
  17. data/lib/beaker/dsl/roles.rb +0 -3
  18. data/lib/beaker/dsl/structure.rb +127 -4
  19. data/lib/beaker/dsl/wrappers.rb +0 -4
  20. data/lib/beaker/host.rb +23 -0
  21. data/lib/beaker/host/unix/pkg.rb +4 -4
  22. data/lib/beaker/host_prebuilt_steps.rb +11 -5
  23. data/lib/beaker/hypervisor/vagrant.rb +1 -0
  24. data/lib/beaker/hypervisor/vmpooler.rb +38 -0
  25. data/lib/beaker/logger.rb +10 -4
  26. data/lib/beaker/network_manager.rb +5 -4
  27. data/lib/beaker/options/command_line_parser.rb +7 -0
  28. data/lib/beaker/shared.rb +2 -1
  29. data/lib/beaker/shared/semvar.rb +41 -0
  30. data/lib/beaker/test_suite.rb +20 -6
  31. data/lib/beaker/version.rb +1 -1
  32. data/spec/beaker/dsl/helpers/facter_helpers_spec.rb +59 -0
  33. data/spec/beaker/dsl/helpers/hiera_helpers_spec.rb +96 -0
  34. data/spec/beaker/dsl/helpers/host_helpers_spec.rb +413 -0
  35. data/spec/beaker/dsl/{helpers_spec.rb → helpers/puppet_helpers_spec.rb} +2 -611
  36. data/spec/beaker/dsl/helpers/tk_helpers_spec.rb +83 -0
  37. data/spec/beaker/dsl/helpers/web_helpers_spec.rb +60 -0
  38. data/spec/beaker/dsl/install_utils/module_utils_spec.rb +241 -0
  39. data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +475 -0
  40. data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +523 -0
  41. data/spec/beaker/dsl/structure_spec.rb +108 -0
  42. data/spec/beaker/host_prebuilt_steps_spec.rb +44 -0
  43. data/spec/beaker/host_spec.rb +41 -0
  44. data/spec/beaker/hypervisor/vagrant_spec.rb +2 -1
  45. data/spec/beaker/logger_spec.rb +9 -2
  46. data/spec/beaker/network_manager_spec.rb +7 -1
  47. data/spec/beaker/options/command_line_parser_spec.rb +3 -2
  48. data/spec/beaker/shared/semvar_spec.rb +36 -0
  49. data/spec/beaker/test_suite_spec.rb +48 -0
  50. data/spec/mocks.rb +10 -0
  51. metadata +23 -5
  52. data/lib/beaker/dsl/ezbake_utils.rb +0 -259
  53. data/spec/beaker/dsl/install_utils_spec.rb +0 -1242
@@ -37,7 +37,6 @@ module Beaker
37
37
  #
38
38
  # @param [String] msg An optional message to log
39
39
  # @raise [FailTest]
40
- # @api dsl
41
40
  def fail_test msg = nil
42
41
  message = formatted_message( msg, 'Failed' )
43
42
  logger.warn( [message, logger.pretty_backtrace].join("\n") )
@@ -49,7 +48,6 @@ module Beaker
49
48
  #
50
49
  # @param [String] msg An optional message to log
51
50
  # @raise [PassTest]
52
- # @api dsl
53
51
  def pass_test msg = nil
54
52
  message = formatted_message( msg, 'Passed' )
55
53
  logger.notify( message )
@@ -61,7 +59,6 @@ module Beaker
61
59
  #
62
60
  # @param [String] msg An optional message to log
63
61
  # @raise [PendingTest]
64
- # @api dsl
65
62
  def pending_test msg = nil
66
63
  message = formatted_message( msg, 'is Pending' )
67
64
  logger.warn( message )
@@ -73,7 +70,6 @@ module Beaker
73
70
  #
74
71
  # @param [String] msg An optional message to log
75
72
  # @raise [SkipTest]
76
- # @api dsl
77
73
  def skip_test msg = nil
78
74
  message = formatted_message( msg, 'was Skipped' )
79
75
  logger.notify( message )
@@ -13,7 +13,6 @@ module Beaker
13
13
  # Also the constant {FailTest} needs to be defined it will be raised
14
14
  # in error conditions
15
15
  #
16
- # @api dsl
17
16
  module Roles
18
17
 
19
18
  # The hosts for which ['roles'] include 'agent'
@@ -127,7 +126,6 @@ module Beaker
127
126
  # puts "master is defined"
128
127
  # end
129
128
  #
130
- # @api public
131
129
  def any_hosts_as?(role)
132
130
  hosts_as(role).length > 0
133
131
  end
@@ -144,7 +142,6 @@ module Beaker
144
142
  # on yak, 'shave'
145
143
  # end
146
144
  #
147
- # @api public
148
145
  def hosts_as(desired_role = nil)
149
146
  hosts_with_role(hosts, desired_role)
150
147
  end
@@ -35,7 +35,6 @@ module Beaker
35
35
  # Provides a method to help structure tests into coherent steps.
36
36
  # @param [String] step_name The name of the step to be logged.
37
37
  # @param [Proc] block The actions to be performed in this step.
38
- # @api dsl
39
38
  def step step_name, &block
40
39
  logger.notify "\n * #{step_name}\n"
41
40
  yield if block_given?
@@ -46,7 +45,6 @@ module Beaker
46
45
  # @param [String] my_name The name of the test to be logged.
47
46
  # @param [Proc] block The actions to be performed during this test.
48
47
  #
49
- # @api dsl
50
48
  def test_name my_name, &block
51
49
  logger.notify "\n#{my_name}\n"
52
50
  yield if block_given?
@@ -61,7 +59,6 @@ module Beaker
61
59
  # on(master, puppet_resource('file', '/etc/puppet/modules',
62
60
  # 'ensure=absent', 'purge=true'))
63
61
  # end
64
- # @api dsl
65
62
  def teardown &block
66
63
  @teardown_procs << block
67
64
  end
@@ -105,7 +102,6 @@ module Beaker
105
102
  # a {Beaker::Assertions} (i.e., if the assert
106
103
  # passes)
107
104
  # @author Chris Cowell-Shah (<tt>ccs@puppetlabs.com</tt>)
108
- # @api dsl
109
105
  def expect_failure(explanation, &block)
110
106
  begin
111
107
  yield if block_given? # code block should contain an assert that you expect to fail
@@ -125,6 +121,133 @@ module Beaker
125
121
  '"expect_failure()" needs to be removed from this test. ' +
126
122
  "Additional info: '#{explanation}'")
127
123
  end
124
+
125
+ # Limit the hosts a test case is run against
126
+ # @note This will modify the {Beaker::TestCase#hosts} member
127
+ # in place unless an array of hosts is passed into it and
128
+ # {Beaker::TestCase#logger} yielding an object that responds
129
+ # like {Beaker::Logger#warn}, as well as
130
+ # {Beaker::DSL::Outcomes#skip_test}, and optionally
131
+ # {Beaker::TestCase#hosts}.
132
+ #
133
+ # @param [Symbol] type The type of confinement to do. Valid parameters
134
+ # are *:to* to confine the hosts to only those that
135
+ # match *criteria* or *:except* to confine the test
136
+ # case to only those hosts that do not match
137
+ # criteria.
138
+ # @param [Hash{Symbol,String=>String,Regexp,Array<String,Regexp>}]
139
+ # criteria Specify the criteria with which a host should be
140
+ # considered for inclusion or exclusion. The key is any attribute
141
+ # of the host that will be yielded by {Beaker::Host#[]}.
142
+ # The value can be any string/regex or array of strings/regexp.
143
+ # The values are compared using [Enumerable#any?] so that if one
144
+ # value of an array matches the host is considered a match for that
145
+ # criteria.
146
+ # @param [Array<Host>] host_array This creatively named parameter is
147
+ # an optional array of hosts to confine to. If not passed in, this
148
+ # method will modify {Beaker::TestCase#hosts} in place.
149
+ # @param [Proc] block Addition checks to determine suitability of hosts
150
+ # for confinement. Each host that is still valid after checking
151
+ # *criteria* is then passed in turn into this block. The block
152
+ # should return true if the host matches this additional criteria.
153
+ #
154
+ # @example Basic usage to confine to debian OSes.
155
+ # confine :to, :platform => 'debian'
156
+ #
157
+ # @example Confining to anything but Windows and Solaris
158
+ # confine :except, :platform => ['windows', 'solaris']
159
+ #
160
+ # @example Using additional block to confine to Solaris global zone.
161
+ # confine :to, :platform => 'solaris' do |solaris|
162
+ # on( solaris, 'zonename' ) =~ /global/
163
+ # end
164
+ #
165
+ # @return [Array<Host>] Returns an array of hosts that are still valid
166
+ # targets for this tests case.
167
+ # @raise [SkipTest] Raises skip test if there are no valid hosts for
168
+ # this test case after confinement.
169
+ def confine(type, criteria, host_array = nil, &block)
170
+ hosts_to_modify = host_array || hosts
171
+ case type
172
+ when :except
173
+ hosts_to_modify = hosts_to_modify - select_hosts(criteria, hosts_to_modify, &block)
174
+ when :to
175
+ hosts_to_modify = select_hosts(criteria, hosts_to_modify, &block)
176
+ else
177
+ raise "Unknown option #{type}"
178
+ end
179
+ if hosts_to_modify.empty?
180
+ logger.warn "No suitable hosts with: #{criteria.inspect}"
181
+ skip_test 'No suitable hosts found'
182
+ end
183
+ self.hosts = hosts_to_modify
184
+ hosts_to_modify
185
+ end
186
+
187
+ # Ensures that host restrictions as specifid by type, criteria and
188
+ # host_array are confined to activity within the passed block.
189
+ # TestCase#hosts is reset after block has executed.
190
+ #
191
+ # @see #confine
192
+ def confine_block(type, criteria, host_array = nil, &block)
193
+ begin
194
+ original_hosts = self.hosts.dup
195
+ confine(type, criteria, host_array)
196
+
197
+ yield
198
+
199
+ ensure
200
+ self.hosts = original_hosts
201
+ end
202
+ end
203
+
204
+ #Return a set of hosts that meet the given criteria
205
+ # @param [Hash{Symbol,String=>String,Regexp,Array<String,Regexp>}]
206
+ # criteria Specify the criteria with which a host should be
207
+ # considered for inclusion. The key is any attribute
208
+ # of the host that will be yielded by {Beaker::Host#[]}.
209
+ # The value can be any string/regex or array of strings/regexp.
210
+ # The values are compared using [Enumerable#any?] so that if one
211
+ # value of an array matches the host is considered a match for that
212
+ # criteria.
213
+ # @param [Array<Host>] host_array This creatively named parameter is
214
+ # an optional array of hosts to confine to. If not passed in, this
215
+ # method will modify {Beaker::TestCase#hosts} in place.
216
+ # @param [Proc] block Addition checks to determine suitability of hosts
217
+ # for selection. Each host that is still valid after checking
218
+ # *criteria* is then passed in turn into this block. The block
219
+ # should return true if the host matches this additional criteria.
220
+ #
221
+ # @return [Array<Host>] Returns an array of hosts that meet the provided criteria
222
+ def select_hosts(criteria, host_array = nil, &block)
223
+ hosts_to_select_from = host_array || hosts
224
+ criteria.each_pair do |property, value|
225
+ hosts_to_select_from = hosts_to_select_from.select do |host|
226
+ inspect_host host, property, value
227
+ end
228
+ end
229
+ if block_given?
230
+ hosts_to_select_from = hosts_to_select_from.select do |host|
231
+ yield host
232
+ end
233
+ end
234
+ hosts_to_select_from
235
+ end
236
+
237
+ # @!visibility private
238
+ def inspect_host(host, property, one_or_more_values)
239
+ values = Array(one_or_more_values)
240
+ return values.any? do |value|
241
+ true_false = false
242
+ case value
243
+ when String
244
+ true_false = host[property.to_s].include? value
245
+ when Regexp
246
+ true_false = host[property.to_s] =~ value
247
+ end
248
+ true_false
249
+ end
250
+ end
128
251
  end
129
252
  end
130
253
  end
@@ -12,7 +12,6 @@ module Beaker
12
12
  # work to disentangle all of the things that are being passed into
13
13
  # this catchall param.
14
14
  #
15
- # @api dsl
16
15
  def facter(*args)
17
16
  options = args.last.is_a?(Hash) ? args.pop : {}
18
17
  options['ENV'] ||= {}
@@ -24,7 +23,6 @@ module Beaker
24
23
  # work to disentangle all of the things that are being passed into
25
24
  # this catchall param.
26
25
  #
27
- # @api dsl
28
26
  def cfacter(*args)
29
27
  options = args.last.is_a?(Hash) ? args.pop : {}
30
28
  options['ENV'] ||= {}
@@ -36,7 +34,6 @@ module Beaker
36
34
  # work to disentangle all of the things that are being passed into
37
35
  # this catchall param.
38
36
  #
39
- # @api dsl
40
37
  def hiera(*args)
41
38
  options = args.last.is_a?(Hash) ? args.pop : {}
42
39
  options['ENV'] ||= {}
@@ -57,7 +54,6 @@ module Beaker
57
54
  # work to disentangle all of the things that are being passed into
58
55
  # this catchall param.
59
56
  #
60
- # @api dsl
61
57
  def puppet(*args)
62
58
  options = args.last.is_a?(Hash) ? args.pop : {}
63
59
  options['ENV'] ||= {}
@@ -59,6 +59,26 @@ module Beaker
59
59
  pkg_initialize
60
60
  end
61
61
 
62
+ # Builds a deprecated keys array, for checking to see if a key is deprecated.
63
+ # The recommended check after using this method is +result.include?(key)+
64
+ #
65
+ # @note an unsupported host type (meaning it has no _aio_defaults_) will return
66
+ # an empty hash
67
+ #
68
+ # @return [Array<Symbol>] An array of keys that are deprecated for a host
69
+ def build_deprecated_keys()
70
+ begin
71
+ deprecated_keys_hash = self.class.send "foss_defaults".to_sym
72
+ delete_exceptions_hash = self.class.send "aio_defaults".to_sym
73
+ deprecated_keys_hash.delete_if do |key, value|
74
+ delete_exceptions_hash.has_key?(key)
75
+ end
76
+ rescue NoMethodError
77
+ deprecated_keys_hash = {}
78
+ end
79
+ deprecated_keys_hash.keys()
80
+ end
81
+
62
82
  def pkg_initialize
63
83
  # This method should be overridden by platform-specific code to
64
84
  # handle whatever packaging-related initialization is necessary.
@@ -114,6 +134,9 @@ module Beaker
114
134
  end
115
135
 
116
136
  def [] k
137
+ @deprecated_keys ||= build_deprecated_keys()
138
+ deprecation_message = "deprecated host key '#{k}'. Perhaps you can use host.puppet[] to get what you're looking for."
139
+ @logger.warn( deprecation_message ) if @logger && @deprecated_keys.include?(k.to_sym)
117
140
  @defaults[k]
118
141
  end
119
142
 
@@ -138,7 +138,7 @@ module Unix::Pkg
138
138
  # DEBIAN_PLATFORM_CODENAMES map must be kept up-to-date as
139
139
  # support for new versions is added.
140
140
  #
141
- # @note See {Beaker::DSL::Helpers#deploy_package_repo} for info on
141
+ # @note See {Beaker::DSL::Helpers::HostHelpers#deploy_package_repo} for info on
142
142
  # params
143
143
  def deploy_apt_repo(path, name, version)
144
144
  codename = DEBIAN_PLATFORM_CODENAMES[self['platform']]
@@ -154,7 +154,7 @@ module Unix::Pkg
154
154
 
155
155
  # Deploy yum configuration generated by the packaging tooling
156
156
  #
157
- # @note See {Beaker::DSL::Helpers#deploy_package_repo} for info on
157
+ # @note See {Beaker::DSL::Helpers::HostHelpers#deploy_package_repo} for info on
158
158
  # params
159
159
  def deploy_yum_repo(path, name, version)
160
160
  repo_file = "#{path}/rpm/pl-#{name}-#{version}-repos-pe-#{self['platform']}.repo"
@@ -163,7 +163,7 @@ module Unix::Pkg
163
163
 
164
164
  # Deploy zypper repo configuration generated by the packaging tooling
165
165
  #
166
- # @note See {Beaker::DSL::Helpers#deploy_package_repo} for info on
166
+ # @note See {Beaker::DSL::Helpers::HostHelpers#deploy_package_repo} for info on
167
167
  # params
168
168
  def deploy_zyp_repo(path, name, version)
169
169
  repo_file = "#{path}/rpm/pl-#{name}-#{version}-repos-pe-#{self['platform']}.repo"
@@ -178,7 +178,7 @@ module Unix::Pkg
178
178
  # This method calls one of #deploy_apt_repo, #deploy_yum_repo, or
179
179
  # #deploy_zyp_repo depending on the platform of this Host.
180
180
  #
181
- # @note See {Beaker::DSL::Helpers#deploy_package_repo} for info on
181
+ # @note See {Beaker::DSL::Helpers::HostHelpers#deploy_package_repo} for info on
182
182
  # params
183
183
  def deploy_package_repo(path, name, version)
184
184
  if not File.exists? path
@@ -339,12 +339,13 @@ module Beaker
339
339
  logger = opts[:logger]
340
340
  block_on host do |host|
341
341
  logger.debug "Update /etc/ssh/sshd_config to allow root login"
342
- # note: this sed command only works on gnu sed
343
342
  if host['platform'] =~ /osx/
344
343
  host.exec(Command.new("sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /etc/sshd_config"))
345
344
  host.exec(Command.new("sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /etc/sshd_config"))
346
- else
345
+ elsif host.is_cygwin?
347
346
  host.exec(Command.new("sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\""), {:pty => true})
347
+ else
348
+ logger.warn("Attempting to enable root login non-supported platform: #{host.name}: #{host['platform']}")
348
349
  end
349
350
  #restart sshd
350
351
  if host['platform'] =~ /debian|ubuntu|cumulus/
@@ -352,7 +353,7 @@ module Beaker
352
353
  elsif host['platform'] =~ /centos|el-|redhat|fedora|eos/
353
354
  host.exec(Command.new("sudo -E /sbin/service sshd reload"), {:pty => true})
354
355
  else
355
- @logger.warn("Attempting to update ssh on non-supported platform: #{host.name}: #{host['platform']}")
356
+ logger.warn("Attempting to update ssh on non-supported platform: #{host.name}: #{host['platform']}")
356
357
  end
357
358
  end
358
359
  end
@@ -487,8 +488,13 @@ module Beaker
487
488
  when /windows/
488
489
  if host.is_cygwin?
489
490
  host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/sshd_config"))
490
- host.exec(Command.new("cygrunsrv -E sshd"))
491
- host.exec(Command.new("cygrunsrv -S sshd"))
491
+ # we get periodic failures to restart the service, so looping these with re-attempts
492
+ repeat_fibonacci_style_for(5) do
493
+ 0 == host.exec(Command.new("cygrunsrv -E sshd"), :acceptable_exit_codes => [0, 1] ).exit_code
494
+ end
495
+ repeat_fibonacci_style_for(5) do
496
+ 0 == host.exec(Command.new("cygrunsrv -S sshd"), :acceptable_exit_codes => [0, 1] ).exit_code
497
+ end
492
498
  env['CYGWIN'] = 'nodosfilewarning'
493
499
  else
494
500
  #nothing to do here
@@ -23,6 +23,7 @@ module Beaker
23
23
  #generate the VagrantFile
24
24
  v_file = "Vagrant.configure(\"2\") do |c|\n"
25
25
  v_file << " c.ssh.forward_agent = true\n" if options[:forward_ssh_agent] == true
26
+ v_file << " c.ssh.insert_key = false\n"
26
27
  hosts.each do |host|
27
28
  host['ip'] ||= randip #use the existing ip, otherwise default to a random ip
28
29
  v_file << " c.vm.define '#{host.name}' do |v|\n"
@@ -106,6 +106,44 @@ module Beaker
106
106
  end
107
107
 
108
108
  @logger.notify 'Spent %.2f seconds grabbing VMs' % (Time.now - start)
109
+
110
+ start = Time.now
111
+ @logger.notify 'Tagging vmpooler VMs'
112
+
113
+ tags = {
114
+ 'jenkins_build_url' => @options[:jenkins_build_url],
115
+ 'department' => @options[:department],
116
+ 'project' => @options[:project],
117
+ 'created_by' => @options[:created_by]
118
+ }
119
+
120
+ @hosts.each_with_index do |h, i|
121
+ begin
122
+ uri = URI.parse(@options[:pooling_api] + '/vm/' + h['vmhostname'].split('.')[0])
123
+
124
+ http = Net::HTTP.new(uri.host, uri.port)
125
+ request = Net::HTTP::Put.new(uri.request_uri)
126
+
127
+ request.body = { 'tags' => tags }.to_json
128
+
129
+ response = http.request(request)
130
+ rescue RuntimeError, Error::EINVAL, Errno::ECONNRESET, EOFError,
131
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, *SSH_EXCEPTIONS => e
132
+ @logger.notify "Failed to connect to vmpooler for tagging!"
133
+ end
134
+
135
+ begin
136
+ parsed_response = JSON.parse(response.body)
137
+
138
+ unless parsed_response['ok']
139
+ @logger.notify "Failed to tag host '#{h['vmhostname']}'!"
140
+ end
141
+ rescue JSON::ParserError => e
142
+ @logger.notify "Failed to tag host '#{h['vmhostname']}'! (failed with #{e.class})"
143
+ end
144
+ end
145
+
146
+ @logger.notify 'Spent %.2f seconds tagging VMs' % (Time.now - start)
109
147
  end
110
148
 
111
149
  def cleanup
@@ -302,12 +302,18 @@ module Beaker
302
302
 
303
303
  # Utility method to centralize dated log folder generation
304
304
  #
305
- # @param [String] base_dir path of the directory for the dated log folder to live in
306
- # @param [Time] timestamp the timestamp that should be used to generate the dated log folder
305
+ # @param [String] base_dir Path of the directory for the dated log folder to live in
306
+ # @param [String] log_prefix Prefix to use for the log files
307
+ # @param [Time] timestamp Timestamp that should be used to generate the dated log folder
308
+ #
309
+ # @example base_dir = 'junit', log_prefix = 'pants', timestamp = '2015-03-04 10:35:37 -0800'
310
+ # returns 'junit/pants/2015-03-04_10_35_37'
311
+ #
312
+ # @note since this uses 'mkdir -p', log_prefix can be a number of nested directories
307
313
  #
308
314
  # @return [String] the path of the dated log folder generated
309
- def Logger.generate_dated_log_folder(base_dir, timestamp)
310
- log_dir = File.join(base_dir, timestamp.strftime("%F_%H_%M_%S"))
315
+ def Logger.generate_dated_log_folder(base_dir, log_prefix, timestamp)
316
+ log_dir = File.join(base_dir, log_prefix, timestamp.strftime("%F_%H_%M_%S"))
311
317
  FileUtils.mkdir_p(log_dir) unless File.directory?(log_dir)
312
318
  log_dir
313
319
  end
@@ -26,10 +26,11 @@ module Beaker
26
26
  @machines = {}
27
27
  @hypervisors = nil
28
28
 
29
- @options[:timestamp] = Time.now unless @options.has_key?(:timestamp)
30
- @options[:xml_dated_dir] = Beaker::Logger.generate_dated_log_folder(@options[:xml_dir], @options[:timestamp])
31
- @options[:log_dated_dir] = Beaker::Logger.generate_dated_log_folder(@options[:log_dir], @options[:timestamp])
32
- @options[:logger_sut] = Beaker::Logger.new(File.join(@options[:log_dated_dir], @options[:log_sut_event]), { :quiet => true })
29
+ @options[:log_prefix] = File.basename(@options[:hosts_file], '.yml') unless @options[:log_prefix]
30
+ @options[:timestamp] = Time.now unless @options.has_key?(:timestamp)
31
+ @options[:xml_dated_dir] = Beaker::Logger.generate_dated_log_folder(@options[:xml_dir], @options[:log_prefix], @options[:timestamp])
32
+ @options[:log_dated_dir] = Beaker::Logger.generate_dated_log_folder(@options[:log_dir], @options[:log_prefix], @options[:timestamp])
33
+ @options[:logger_sut] = Beaker::Logger.new(File.join(@options[:log_dated_dir], @options[:log_sut_event]), { :quiet => true })
33
34
  end
34
35
 
35
36
  #Provision all virtual machines. Provision machines according to their set hypervisor, if no hypervisor