testlab 1.12.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/tl CHANGED
@@ -128,8 +128,8 @@ pre do |global,command,options,args|
128
128
 
129
129
  if !@ui.quiet?
130
130
  message = format_message("TestLab v#{TestLab::VERSION} Loaded".black.bold)
131
- @testlab.ui.stdout.puts(message)
132
- @testlab.ui.logger.info { message }
131
+ @ui.stdout.puts(message)
132
+ @ui.logger.info { message }
133
133
  end
134
134
 
135
135
  true
@@ -140,8 +140,8 @@ post do |global,command,options,args|
140
140
 
141
141
  if !@ui.quiet?
142
142
  message = format_message("TestLab v#{TestLab::VERSION} Finished (%0.4f seconds)".black.bold % testlab_run_time)
143
- @testlab.ui.stdout.puts(message)
144
- @testlab.ui.logger.info { message }
143
+ @ui.stdout.puts(message)
144
+ @ui.logger.info { message }
145
145
  end
146
146
 
147
147
  true
@@ -168,8 +168,8 @@ on_error do |exception|
168
168
  end
169
169
 
170
170
  message = format_message("TestLab v#{TestLab::VERSION} Aborted (%0.4f seconds)".black.bold % testlab_run_time)
171
- @testlab.ui.stderr.puts(message)
172
- @testlab.ui.logger.info { message }
171
+ @ui.stderr.puts(message)
172
+ @ui.logger.info { message }
173
173
 
174
174
  false
175
175
  end
@@ -85,15 +85,10 @@ class TestLab
85
85
 
86
86
  please_wait(:ui => @ui, :message => format_object_action(self, 'Compress', :cyan)) do
87
87
  self.node.bootstrap(<<-EOF)
88
- set -x
89
- set -e
90
-
91
88
  du -sh #{self.lxc.container_root}
92
-
93
89
  cd #{self.lxc.container_root}
94
90
  find #{root_fs_path} -depth -print0 | cpio -o0 | pbzip2 -#{compression} -vfczm#{PBZIP2_MEMORY} > #{remote_file}
95
91
  chown ${SUDO_USER}:${SUDO_USER} #{remote_file}
96
-
97
92
  ls -lah #{remote_file}
98
93
  EOF
99
94
  end
@@ -105,9 +100,6 @@ EOF
105
100
  self.node.download(remote_file, local_file, :on_progress => method(:progress_callback), :read_size => READ_SIZE)
106
101
 
107
102
  self.node.bootstrap(<<-EOF)
108
- set -x
109
- set -e
110
-
111
103
  rm -fv #{remote_file}
112
104
  EOF
113
105
 
@@ -157,17 +149,11 @@ EOF
157
149
 
158
150
  please_wait(:ui => @ui, :message => format_object_action(self, 'Expand', :cyan)) do
159
151
  self.node.bootstrap(<<-EOF)
160
- set -x
161
- set -e
162
-
163
152
  ls -lah #{remote_file}
164
-
165
153
  rm -rf #{self.lxc.fs_root}
166
154
  cd #{self.lxc.container_root}
167
155
  pbzip2 -vdcm#{PBZIP2_MEMORY} #{remote_file} | cpio -uid && rm -fv #{remote_file}
168
-
169
156
  du -sh #{self.lxc.container_root}
170
-
171
157
  rm -fv #{remote_file}
172
158
  EOF
173
159
  end
@@ -22,10 +22,16 @@ class TestLab
22
22
  end
23
23
 
24
24
  def ok?
25
- self.alive? or return false
25
+ self.dead? and return false
26
26
 
27
27
  result = true
28
28
 
29
+ if !self.lxc.installed?
30
+ # @ui.stderr.puts(format_message("ERROR: "))
31
+ raise NodeError, "LXC does not appear to be installed on your TestLab node! (Did you forget to provision or build the node?)"
32
+ # result = false
33
+ end
34
+
29
35
  # make sure the node has some free space
30
36
  free_space_percent = (self.exec(%(df -P /), :ignore_exit_status => true).output.split("\n")[1].split[-2].to_i rescue nil)
31
37
  if free_space_percent.nil?
@@ -36,8 +42,13 @@ class TestLab
36
42
  result = false
37
43
  end
38
44
 
45
+ # get the names of all of the defined containers
39
46
  my_container_names = self.containers.map(&:id)
40
- node_container_names = self.lxc.containers.map(&:name)
47
+
48
+ # ephemeral containers parent containers have a "-master" suffix; we need to remove these from the results or we will complain about them
49
+ node_container_names = self.lxc.containers.map(&:name).delete_if do |node_container_name|
50
+ my_container_names.any?{ |my_container_name| "#{my_container_name}-master" == node_container_name }
51
+ end
41
52
 
42
53
  unknown_container_names = (node_container_names - my_container_names)
43
54
  unknown_running_container_names = self.lxc.containers.select{ |c| (unknown_container_names.include?(c.name) && (c.state == :running)) }.map(&:name)
@@ -1,6 +1,6 @@
1
1
  class TestLab
2
2
  unless const_defined?(:VERSION)
3
3
  # TestLab Gem Version
4
- VERSION = "1.12.0"
4
+ VERSION = "1.13.0"
5
5
  end
6
6
  end
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: 1.12.0
4
+ version: 1.13.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-05 00:00:00.000000000 Z
12
+ date: 2013-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
@@ -350,7 +350,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
350
350
  version: '0'
351
351
  segments:
352
352
  - 0
353
- hash: -750207504025020924
353
+ hash: -3460081152239272666
354
354
  required_rubygems_version: !ruby/object:Gem::Requirement
355
355
  none: false
356
356
  requirements:
@@ -359,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
359
  version: '0'
360
360
  segments:
361
361
  - 0
362
- hash: -750207504025020924
362
+ hash: -3460081152239272666
363
363
  requirements: []
364
364
  rubyforge_project:
365
365
  rubygems_version: 1.8.25