testlab 0.6.15 → 0.6.16

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 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[:v] == true) and ENV['LOG_LEVEL'] = 'DEBUG'
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[:q] == false)
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
@@ -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
- output = nil
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
@@ -121,9 +121,9 @@ class TestLab
121
121
 
122
122
 
123
123
  def initialize(*args)
124
- super(*args)
125
-
126
124
  @ui = TestLab.ui
125
+
126
+ super(*args)
127
127
  end
128
128
 
129
129
  end
@@ -19,9 +19,9 @@ class TestLab
19
19
  attribute :primary, :default => false
20
20
 
21
21
  def initialize(*args)
22
- super(*args)
23
-
24
22
  @ui = TestLab.ui
23
+
24
+ super(*args)
25
25
  end
26
26
 
27
27
  def ip
@@ -37,9 +37,9 @@ class TestLab
37
37
 
38
38
 
39
39
  def initialize(*args)
40
- super(*args)
41
-
42
40
  @ui = TestLab.ui
41
+
42
+ super(*args)
43
43
  end
44
44
 
45
45
  end
@@ -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
- @lxc ||= ::LXC.new
15
- @lxc.use_sudo = true
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
- super(*args)
44
+ @ui = TestLab.ui
45
45
 
46
- raise NodeError, "You must specify a provider class!" if self.provider.nil?
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
@@ -27,9 +27,9 @@ class TestLab
27
27
  attribute :primary, :default => false
28
28
 
29
29
  def initialize(*args)
30
- super(*args)
31
-
32
30
  @ui = TestLab.ui
31
+
32
+ super(*args)
33
33
  end
34
34
 
35
35
  end
@@ -1,6 +1,6 @@
1
1
  class TestLab
2
2
  unless const_defined?(:VERSION)
3
3
  # TestLab Gem Version
4
- VERSION = "0.6.15"
4
+ VERSION = "0.6.16"
5
5
  end
6
6
  end
data/lib/testlab.rb CHANGED
@@ -307,7 +307,7 @@ class TestLab
307
307
  # class.
308
308
  module DualMethods
309
309
 
310
- @@ui = nil
310
+ @@ui ||= nil
311
311
 
312
312
  # Get Test Lab User Interface
313
313
  #
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.15
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: -738732606304836077
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: -738732606304836077
315
+ hash: -1123955355283621213
316
316
  requirements: []
317
317
  rubyforge_project:
318
318
  rubygems_version: 1.8.25