testlab 0.6.15 → 0.6.16
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/tl +8 -3
- data/lib/commands/container.rb +0 -2
- data/lib/testlab/container/lxc.rb +1 -18
- data/lib/testlab/container.rb +2 -2
- data/lib/testlab/interface.rb +2 -2
- data/lib/testlab/network.rb +2 -2
- data/lib/testlab/node/lxc.rb +2 -3
- data/lib/testlab/node.rb +4 -3
- data/lib/testlab/user.rb +2 -2
- data/lib/testlab/version.rb +1 -1
- data/lib/testlab.rb +1 -1
- metadata +3 -3
data/bin/tl
CHANGED
@@ -46,8 +46,13 @@ desc 'Quiet mode'
|
|
46
46
|
default_value false
|
47
47
|
switch [:q, :quiet]
|
48
48
|
|
49
|
+
desc 'Path to Labfile'
|
50
|
+
arg_name 'path/to/file'
|
51
|
+
default_value File.join(Dir.pwd, 'Labfile')
|
52
|
+
flag [:l, :labfile]
|
53
|
+
|
49
54
|
pre do |global,command,options,args|
|
50
|
-
(global[:
|
55
|
+
(global[:verbose] == true) and ENV['LOG_LEVEL'] = 'DEBUG'
|
51
56
|
|
52
57
|
log_file = File.join(Dir.pwd, "testlab-#{HOSTNAME}.log")
|
53
58
|
@logger = ZTK::Logger.new(log_file)
|
@@ -57,11 +62,11 @@ pre do |global,command,options,args|
|
|
57
62
|
@logger.debug { "args(#{args.inspect})" }
|
58
63
|
|
59
64
|
@ui = ZTK::UI.new(:logger => @logger)
|
60
|
-
@testlab = TestLab.new(:ui => @ui)
|
65
|
+
@testlab = TestLab.new(:ui => @ui, :labfile => global[:labfile])
|
61
66
|
|
62
67
|
TestLab::Utility.log_header(@testlab).each { |line| @logger.info { line } }
|
63
68
|
|
64
|
-
if (global[:
|
69
|
+
if (global[:quiet] == false)
|
65
70
|
message = format_message("TestLab v#{TestLab::VERSION} Loaded".black.bold)
|
66
71
|
@testlab.ui.stdout.puts(message)
|
67
72
|
end
|
data/lib/commands/container.rb
CHANGED
@@ -179,9 +179,7 @@ EOF
|
|
179
179
|
if containers.count == 0
|
180
180
|
@testlab.ui.stderr.puts("You either have no containers defined or dead nodes!".yellow)
|
181
181
|
else
|
182
|
-
# ZTK::Report.new(:ui => @testlab.ui).spreadsheet(containers, TestLab::Container::STATUS_KEYS.reject{|k| k == :fqdn}) do |container|
|
183
182
|
ZTK::Report.new(:ui => @testlab.ui).list(containers, TestLab::Container::STATUS_KEYS) do |container|
|
184
|
-
# OpenStruct.new(container.status.reject{|k,v| k == :fqdn})
|
185
183
|
OpenStruct.new(container.status)
|
186
184
|
end
|
187
185
|
end
|
@@ -18,24 +18,7 @@ class TestLab
|
|
18
18
|
# execute. This is generally a bash script of some sort for example.
|
19
19
|
# @return [String] The output of *lxc-attach*.
|
20
20
|
def bootstrap(content)
|
21
|
-
|
22
|
-
|
23
|
-
ZTK::RescueRetry.try(:tries => 5, :on => ContainerError) do
|
24
|
-
tempfile = Tempfile.new("bootstrap")
|
25
|
-
remote_tempfile = File.join("/", "tmp", File.basename(tempfile.path))
|
26
|
-
target_tempfile = File.join(self.fs_root, remote_tempfile)
|
27
|
-
|
28
|
-
self.node.ssh.file(:target => target_tempfile, :chmod => '0777', :chown => 'root:root') do |file|
|
29
|
-
file.puts(content)
|
30
|
-
end
|
31
|
-
|
32
|
-
output = self.lxc.attach(%(--), %(/bin/bash), remote_tempfile)
|
33
|
-
if !(output =~ /#{remote_tempfile}: No such file or directory/).nil?
|
34
|
-
raise ContainerError, "We could not find the bootstrap file!"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
output
|
21
|
+
self.lxc.bootstrap(content)
|
39
22
|
end
|
40
23
|
|
41
24
|
# LXC::Container object
|
data/lib/testlab/container.rb
CHANGED
data/lib/testlab/interface.rb
CHANGED
data/lib/testlab/network.rb
CHANGED
data/lib/testlab/node/lxc.rb
CHANGED
@@ -11,9 +11,8 @@ class TestLab
|
|
11
11
|
# @return [LXC] An instance of LXC configured for this node.
|
12
12
|
def lxc(options={})
|
13
13
|
if (!defined?(@lxc) || @lxc.nil?)
|
14
|
-
@
|
15
|
-
@lxc.
|
16
|
-
@lxc.use_ssh = self.ssh
|
14
|
+
@lxc_runner ||= ::LXC::Runner::SSH.new(:ui => @ui, :ssh => self.ssh)
|
15
|
+
@lxc ||= ::LXC.new(:ui => @ui, :runner => @lxc_runner)
|
17
16
|
end
|
18
17
|
@lxc
|
19
18
|
end
|
data/lib/testlab/node.rb
CHANGED
@@ -41,12 +41,13 @@ class TestLab
|
|
41
41
|
|
42
42
|
|
43
43
|
def initialize(*args)
|
44
|
-
|
44
|
+
@ui = TestLab.ui
|
45
45
|
|
46
|
-
|
46
|
+
super(*args)
|
47
47
|
|
48
|
-
@ui = TestLab.ui
|
49
48
|
@provider = self.provider.new(self.config, @ui)
|
49
|
+
|
50
|
+
raise NodeError, "You must specify a provider class!" if self.provider.nil?
|
50
51
|
end
|
51
52
|
|
52
53
|
end
|
data/lib/testlab/user.rb
CHANGED
data/lib/testlab/version.rb
CHANGED
data/lib/testlab.rb
CHANGED
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.6.
|
4
|
+
version: 0.6.16
|
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: -1123955355283621213
|
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: -1123955355283621213
|
316
316
|
requirements: []
|
317
317
|
rubyforge_project:
|
318
318
|
rubygems_version: 1.8.25
|