testlab 0.7.3 → 0.7.4
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.
- data/bin/tl +2 -4
- data/lib/testlab/container/actions.rb +2 -2
- data/lib/testlab/container/class_methods.rb +1 -1
- data/lib/testlab/container/status.rb +1 -1
- data/lib/testlab/node.rb +5 -0
- data/lib/testlab/utility/logger.rb +1 -1
- data/lib/testlab/version.rb +1 -1
- data/lib/testlab.rb +10 -5
- data/spec/support/Labfile +5 -7
- metadata +3 -3
data/bin/tl
CHANGED
@@ -26,8 +26,6 @@ require 'testlab'
|
|
26
26
|
include GLI::App
|
27
27
|
include TestLab::Utility::Misc
|
28
28
|
|
29
|
-
HOSTNAME = Socket.gethostname.split('.').first.strip
|
30
|
-
|
31
29
|
version TestLab::VERSION
|
32
30
|
|
33
31
|
program_desc %(TestLab - A toolkit for building virtual computer labs)
|
@@ -58,13 +56,13 @@ flag [:r, :repo]
|
|
58
56
|
|
59
57
|
desc 'Path to Configuration directory: ${PWD}/.testlab-$(hostname -s)'
|
60
58
|
arg_name 'path/to/directory'
|
61
|
-
default_value File.join(Dir.pwd, ".testlab-#{
|
59
|
+
default_value File.join(Dir.pwd, ".testlab-#{TestLab.hostname}")
|
62
60
|
flag [:c, :config]
|
63
61
|
|
64
62
|
pre do |global,command,options,args|
|
65
63
|
(global[:verbose] == true) and (ENV['LOG_LEVEL'] = 'DEBUG')
|
66
64
|
|
67
|
-
log_file = File.join(Dir.pwd, "testlab-#{
|
65
|
+
log_file = File.join(Dir.pwd, "testlab-#{TestLab.hostname}.log")
|
68
66
|
@logger = ZTK::Logger.new(log_file)
|
69
67
|
|
70
68
|
@ui = ZTK::UI.new(
|
@@ -119,8 +119,8 @@ class TestLab
|
|
119
119
|
|
120
120
|
# Configure the container
|
121
121
|
def configure
|
122
|
-
self.domain
|
123
|
-
self.arch
|
122
|
+
self.domain ||= self.node.domain
|
123
|
+
self.arch ||= detect_arch
|
124
124
|
|
125
125
|
build_lxc_config(self.lxc.config)
|
126
126
|
|
@@ -11,7 +11,7 @@ class TestLab
|
|
11
11
|
# @return [Array<String>] A unique array of all defined domain names.
|
12
12
|
def domains
|
13
13
|
self.all.map do |container|
|
14
|
-
container.domain ||= container.node.
|
14
|
+
container.domain ||= container.node.domain
|
15
15
|
container.domain
|
16
16
|
end.compact.uniq
|
17
17
|
end
|
data/lib/testlab/node.rb
CHANGED
@@ -21,7 +21,7 @@ class TestLab
|
|
21
21
|
|
22
22
|
def log_details(testlab)
|
23
23
|
{
|
24
|
-
"hostname" => Socket.gethostname.inspect,
|
24
|
+
"hostname" => "%s (%s)" % [Socket.gethostname.inspect, TestLab.hostname.inspect],
|
25
25
|
"program" => $0.to_s.inspect,
|
26
26
|
"config_dir" => testlab.config_dir.inspect,
|
27
27
|
"repo_dir" => testlab.repo_dir.inspect,
|
data/lib/testlab/version.rb
CHANGED
data/lib/testlab.rb
CHANGED
@@ -84,10 +84,6 @@ require 'testlab/monkeys'
|
|
84
84
|
# @author Zachary Patten <zachary AT jovelabs DOT com>
|
85
85
|
class TestLab
|
86
86
|
|
87
|
-
unless const_defined?(:HOSTNAME)
|
88
|
-
HOSTNAME = Socket.gethostname.split('.').first.strip
|
89
|
-
end
|
90
|
-
|
91
87
|
# TestLab Error Class
|
92
88
|
class TestLabError < StandardError; end
|
93
89
|
|
@@ -112,7 +108,7 @@ class TestLab
|
|
112
108
|
self.ui = (options[:ui] || ZTK::UI.new)
|
113
109
|
self.class.ui = self.ui
|
114
110
|
|
115
|
-
@config_dir = (options[:config_dir] || File.join(Dir.pwd, ".testlab-#{
|
111
|
+
@config_dir = (options[:config_dir] || File.join(Dir.pwd, ".testlab-#{TestLab.hostname}"))
|
116
112
|
@repo_dir = (options[:repo_dir] || Dir.pwd)
|
117
113
|
|
118
114
|
labfile = (options[:labfile] || File.join(Dir.pwd, 'Labfile'))
|
@@ -340,6 +336,15 @@ class TestLab
|
|
340
336
|
value
|
341
337
|
end
|
342
338
|
|
339
|
+
# TestLab Hostname
|
340
|
+
#
|
341
|
+
# Gets the hostname portion of the fqdn for the current host.
|
342
|
+
#
|
343
|
+
# @return [String] The hostname for the current host.
|
344
|
+
def hostname
|
345
|
+
Socket.gethostname.split('.').first.strip
|
346
|
+
end
|
347
|
+
|
343
348
|
# Test Lab Gem Directory
|
344
349
|
#
|
345
350
|
# Returns the directory path to where the gem is installed.
|
data/spec/support/Labfile
CHANGED
@@ -9,12 +9,7 @@ EOF
|
|
9
9
|
|
10
10
|
REPO = File.dirname(__FILE__)
|
11
11
|
|
12
|
-
|
13
|
-
:domain => "default.zone",
|
14
|
-
:repo => REPO
|
15
|
-
})
|
16
|
-
|
17
|
-
node :localhost do
|
12
|
+
node :vagrant do
|
18
13
|
|
19
14
|
provider TestLab::Provider::Vagrant
|
20
15
|
provisioners [
|
@@ -28,7 +23,10 @@ node :localhost do
|
|
28
23
|
:port => 22,
|
29
24
|
:cpus => 1,
|
30
25
|
:memory => 512,
|
31
|
-
:file =>
|
26
|
+
:file => Dir.pwd
|
27
|
+
},
|
28
|
+
:bind => {
|
29
|
+
:domain => "default.zone"
|
32
30
|
}
|
33
31
|
})
|
34
32
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -303,7 +303,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
303
303
|
version: '0'
|
304
304
|
segments:
|
305
305
|
- 0
|
306
|
-
hash: -
|
306
|
+
hash: -2914304308752783600
|
307
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
308
308
|
none: false
|
309
309
|
requirements:
|
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
312
312
|
version: '0'
|
313
313
|
segments:
|
314
314
|
- 0
|
315
|
-
hash: -
|
315
|
+
hash: -2914304308752783600
|
316
316
|
requirements: []
|
317
317
|
rubyforge_project:
|
318
318
|
rubygems_version: 1.8.25
|