testlab 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ class TestLab
8
8
 
9
9
  PBZIP2_MEMORY = 1024
10
10
  READ_SIZE = ((64 * 1024) - 1)
11
- TRANSFER_MESSAGE = "transferring '%s' at %0.2fMB/s -- %0.2fMB of %0.2fMB -- %d%% \r"
11
+ TRANSFER_MESSAGE = "transferring '%s' at %0.2fMB/s -- %0.2fMB of %0.2fMB -- %d%% (%01d:%02dT-%01d:%02d) \r"
12
12
 
13
13
  def progress_callback(action, args)
14
14
  @total_size ||= 0
@@ -22,15 +22,24 @@ class TestLab
22
22
  end
23
23
 
24
24
  when :get, :put then
25
+ elapsed = (Time.now - @start_time)
26
+
25
27
  current_size = (args[1] + args[2].length)
26
28
  current_size_mb = (current_size.to_f / (1024 * 1024).to_f)
27
29
 
28
- elapsed = (Time.now - @start_time)
29
- speed_mb = (current_size.to_f / elapsed.to_f) / (1024 * 1024).to_f
30
+ speed = (current_size.to_f / elapsed.to_f)
31
+ speed_mb = speed / (1024 * 1024).to_f
32
+
33
+ minutes = elapsed.div(60)
34
+ seconds = elapsed.modulo(60)
35
+
36
+ estimated = ((@total_size.to_f - current_size).to_f / speed)
37
+ est_minutes = estimated.div(60)
38
+ est_seconds = estimated.modulo(60)
30
39
 
31
40
  percentage_done = ((current_size * 100) / @total_size)
32
41
 
33
- @ui.stdout.print(format_message(TRANSFER_MESSAGE.yellow % [File.basename(args[0].local), speed_mb, current_size_mb, @total_size_mb, percentage_done]))
42
+ @ui.stdout.print(format_message(TRANSFER_MESSAGE.yellow % [File.basename(args[0].local), speed_mb, current_size_mb, @total_size_mb, percentage_done, minutes, seconds, est_minutes, est_seconds]))
34
43
 
35
44
  when :finish
36
45
  @ui.stdout.puts
@@ -51,6 +60,9 @@ class TestLab
51
60
  # ephemeral state.
52
61
  self.lxc_clone.exists? and raise ContainerError, 'You can not export ephemeral containers!'
53
62
 
63
+ # Run our callbacks
64
+ do_provisioner_callbacks(self, :export, @ui)
65
+
54
66
  # Ensure the container is stopped before we attempt to export it.
55
67
  self.down
56
68
 
@@ -149,6 +161,11 @@ rm -fv #{remote_file}
149
161
  EOF
150
162
  end
151
163
 
164
+ self.up
165
+
166
+ # Run our callbacks
167
+ do_provisioner_callbacks(self, :import, @ui)
168
+
152
169
  @ui.stdout.puts(format_message("Your shipping container is now imported and available for use!".green.bold))
153
170
 
154
171
  true
@@ -234,9 +251,19 @@ EOF
234
251
 
235
252
  new_progress = (current_size * 100) / total_size
236
253
  unless new_progress == progress
237
- elapsed = (Time.now - start_time)
238
- speed_mb = (current_size.to_f / elapsed.to_f) / (1024 * 1024).to_f
239
- @ui.stdout.print(format_message(TRANSFER_MESSAGE.yellow % [File.basename(local_file), speed_mb, current_size_mb, total_size_mb, new_progress]))
254
+ elapsed = (Time.now - start_time)
255
+
256
+ speed = (current_size.to_f / elapsed.to_f)
257
+ speed_mb = speed / (1024 * 1024).to_f
258
+
259
+ minutes = elapsed.div(60)
260
+ seconds = elapsed.modulo(60)
261
+
262
+ estimated = ((total_size.to_f - current_size).to_f / speed)
263
+ est_minutes = estimated.div(60)
264
+ est_seconds = estimated.modulo(60)
265
+
266
+ @ui.stdout.print(format_message(TRANSFER_MESSAGE.yellow % [File.basename(local_file), speed_mb, current_size_mb, total_size_mb, new_progress, minutes, seconds, est_minutes, est_seconds]))
240
267
  end
241
268
  progress = new_progress
242
269
  end
@@ -9,9 +9,10 @@ class TestLab
9
9
  class Provider
10
10
  PROXY_METHODS = %w(instance_id state user identity ip port create destroy up down reload status alive? dead? exists?).map(&:to_sym)
11
11
 
12
- autoload :AWS, 'testlab/providers/aws'
13
- autoload :Local, 'testlab/providers/local'
14
- autoload :Vagrant, 'testlab/providers/vagrant'
12
+ autoload :AWS, 'testlab/providers/aws'
13
+ autoload :Local, 'testlab/providers/local'
14
+ autoload :OpenStack, 'testlab/providers/open_stack'
15
+ autoload :Vagrant, 'testlab/providers/vagrant'
15
16
 
16
17
  class << self
17
18
 
@@ -0,0 +1,20 @@
1
+ class TestLab
2
+
3
+ class Provider
4
+
5
+ # OpenStack Provider Error Class
6
+ class OpenStackError < ProviderError; end
7
+
8
+ # OpenStack Provider Class
9
+ #
10
+ # @author Zachary Patten <zachary AT jovelabs DOT com>
11
+ class OpenStack
12
+
13
+ def initialize(ui=ZTK::UI.new)
14
+ @ui = ui
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
@@ -1,6 +1,6 @@
1
1
  class TestLab
2
2
  unless const_defined?(:VERSION)
3
3
  # TestLab Gem Version
4
- VERSION = "1.8.1"
4
+ VERSION = "1.8.2"
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.8.1
4
+ version: 1.8.2
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-09-16 00:00:00.000000000 Z
12
+ date: 2013-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
@@ -275,6 +275,7 @@ files:
275
275
  - lib/testlab/provider.rb
276
276
  - lib/testlab/providers/aws.rb
277
277
  - lib/testlab/providers/local.rb
278
+ - lib/testlab/providers/open_stack.rb
278
279
  - lib/testlab/providers/templates/vagrant/Vagrantfile.erb
279
280
  - lib/testlab/providers/vagrant.rb
280
281
  - lib/testlab/provisioner.rb
@@ -343,7 +344,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
343
344
  version: '0'
344
345
  segments:
345
346
  - 0
346
- hash: 2144885167691104843
347
+ hash: -2021953625576057715
347
348
  required_rubygems_version: !ruby/object:Gem::Requirement
348
349
  none: false
349
350
  requirements:
@@ -352,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
353
  version: '0'
353
354
  segments:
354
355
  - 0
355
- hash: 2144885167691104843
356
+ hash: -2021953625576057715
356
357
  requirements: []
357
358
  rubyforge_project:
358
359
  rubygems_version: 1.8.25