testlab 1.0.1 → 1.1.0

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.
Files changed (41) hide show
  1. data/README.md +1 -1
  2. data/bin/tl +5 -3
  3. data/features/support/Labfile.local +2 -8
  4. data/features/support/Labfile.vagrant +2 -5
  5. data/lib/testlab/container/actions.rb +1 -41
  6. data/lib/testlab/container/clone.rb +87 -0
  7. data/lib/testlab/container/configuration.rb +67 -0
  8. data/lib/testlab/container/io.rb +8 -8
  9. data/lib/testlab/container/lifecycle.rb +0 -40
  10. data/lib/testlab/container/lxc.rb +0 -143
  11. data/lib/testlab/container/provision.rb +49 -0
  12. data/lib/testlab/container/support.rb +47 -0
  13. data/lib/testlab/container.rb +10 -0
  14. data/lib/testlab/network/actions.rb +4 -4
  15. data/lib/testlab/network/lifecycle.rb +0 -28
  16. data/lib/testlab/network/provision.rb +37 -0
  17. data/lib/testlab/network/status.rb +2 -2
  18. data/lib/testlab/network.rb +2 -0
  19. data/lib/testlab/node/lifecycle.rb +0 -26
  20. data/lib/testlab/node/lxc.rb +1 -13
  21. data/lib/testlab/node/provision.rb +34 -0
  22. data/lib/testlab/node.rb +4 -0
  23. data/lib/testlab/provisioners/apt.rb +1 -0
  24. data/lib/testlab/provisioners/apt_cacher_ng.rb +5 -5
  25. data/lib/testlab/provisioners/bind.rb +35 -18
  26. data/lib/testlab/provisioners/chef/omni_bus.rb +3 -3
  27. data/lib/testlab/provisioners/chef/ruby_gem_client.rb +3 -3
  28. data/lib/testlab/provisioners/resolv.rb +14 -6
  29. data/lib/testlab/provisioners/route.rb +5 -2
  30. data/lib/testlab/provisioners/templates/apt/provision.erb +3 -0
  31. data/lib/testlab/provisioners/templates/bind/bind.erb +5 -2
  32. data/lib/testlab/provisioners/templates/raring/provision.erb +13 -10
  33. data/lib/testlab/provisioners/templates/resolv/resolv.conf.erb +4 -2
  34. data/lib/testlab/support/execution.rb +46 -0
  35. data/lib/testlab/support.rb +17 -0
  36. data/lib/testlab/user/lifecycle.rb +6 -6
  37. data/lib/testlab/utility/gli.rb +3 -3
  38. data/lib/testlab/utility/misc.rb +8 -0
  39. data/lib/testlab/version.rb +1 -1
  40. data/lib/testlab.rb +1 -0
  41. metadata +10 -8
@@ -0,0 +1,17 @@
1
+ class TestLab
2
+
3
+ # Support Error Class
4
+ class SupportError < TestLabError; end
5
+
6
+ # Support Module
7
+ #
8
+ # This module defines our object support namespace. This namespace should
9
+ # provide modules we can mixin to our various objects (containers, networks,
10
+ # nodes).
11
+ #
12
+ # @author Zachary Patten <zachary AT jovelabs DOT com>
13
+ module Support
14
+ autoload :Execution, 'testlab/support/execution'
15
+ end
16
+
17
+ end
@@ -14,11 +14,11 @@ class TestLab
14
14
 
15
15
  # ensure the container user exists
16
16
  container_passwd_file = File.join(self.container.fs_root, "etc", "passwd")
17
- if self.container.node.ssh.exec(%(sudo grep "#{self.username}" #{container_passwd_file}), :ignore_exit_status => true).exit_code != 0
17
+ if self.container.node.exec(%(sudo grep "#{self.username}" #{container_passwd_file}), :ignore_exit_status => true).exit_code != 0
18
18
 
19
19
  if !self.gid.nil?
20
20
  groupadd_command = %(groupadd --gid #{self.gid} #{self.username})
21
- self.container.node.ssh.exec(%(sudo chroot #{self.container.fs_root} /bin/bash -c '#{groupadd_command}'))
21
+ self.container.node.exec(%(sudo chroot #{self.container.fs_root} /bin/bash -c '#{groupadd_command}'))
22
22
  end
23
23
 
24
24
  useradd_command = %W(useradd --create-home --shell /bin/bash --groups sudo)
@@ -50,15 +50,15 @@ class TestLab
50
50
 
51
51
  authkeys.each do |destination, source|
52
52
  @ui.logger.info { "SOURCE: #{source} >>> #{destination}" }
53
- self.container.node.ssh.exec(%(sudo mkdir -pv #{File.dirname(destination)}))
53
+ self.container.node.exec(%(sudo mkdir -pv #{File.dirname(destination)}))
54
54
 
55
- self.container.node.ssh.exec(%(sudo grep "$(cat #{source})" #{destination} || sudo cat #{source} | sudo tee -a #{destination}))
55
+ self.container.node.exec(%(sudo grep "$(cat #{source})" #{destination} || sudo cat #{source} | sudo tee -a #{destination}))
56
56
 
57
57
  public_identities.each do |pi|
58
- self.container.node.ssh.exec(%(sudo grep "#{pi}" #{destination} || sudo echo "#{pi}" | sudo tee -a #{destination}))
58
+ self.container.node.exec(%(sudo grep "#{pi}" #{destination} || sudo echo "#{pi}" | sudo tee -a #{destination}))
59
59
  end
60
60
 
61
- self.container.node.ssh.exec(%(sudo chmod -v 644 #{destination}))
61
+ self.container.node.exec(%(sudo chmod -v 644 #{destination}))
62
62
  end
63
63
 
64
64
  # ensure the container user home directory is owned by them
@@ -7,11 +7,11 @@ class TestLab
7
7
  module GLI
8
8
  require 'ztk'
9
9
 
10
- LAB_ACTION_ORDER = %W(create destroy up down provision deprovision build demolish).map(&:to_sym)
10
+ LAB_ACTION_ORDER = %W(build demolish create destroy up down provision deprovision).map(&:to_sym)
11
11
 
12
12
  LAB_ACTIONS = {
13
- :create => ["Construct %s", "Attempts to create the <%= @component %>."],
14
- :destroy => ["Destruct %s", "Attempts to destroy the <%= @component %>."],
13
+ :create => ["Initialize %s", "Attempts to create the <%= @component %>."],
14
+ :destroy => ["Terminate %s", "Attempts to destroy the <%= @component %>."],
15
15
  :up => ["On-line %s", "Attempts to online the <%= @component %>."],
16
16
  :down => ["Off-line %s", "Attempts to offline the <%= @component %>."],
17
17
  :provision => ["Provision %s", "Attempts to provision the <%= @component %>."],
@@ -55,6 +55,14 @@ class TestLab
55
55
  end
56
56
  end
57
57
 
58
+ def sudo
59
+ %(sudo -p '#{sudo_prompt}')
60
+ end
61
+
62
+ def sudo_prompt
63
+ %(sudo password for %u@%h: )
64
+ end
65
+
58
66
  end
59
67
 
60
68
  end
@@ -1,6 +1,6 @@
1
1
  class TestLab
2
2
  unless const_defined?(:VERSION)
3
3
  # TestLab Gem Version
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.0"
5
5
  end
6
6
  end
data/lib/testlab.rb CHANGED
@@ -127,6 +127,7 @@ class TestLab
127
127
  autoload :Node, 'testlab/node'
128
128
  autoload :Provider, 'testlab/provider'
129
129
  autoload :Provisioner, 'testlab/provisioner'
130
+ autoload :Support, 'testlab/support'
130
131
  autoload :User, 'testlab/user'
131
132
  autoload :Utility, 'testlab/utility'
132
133
 
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.0.1
4
+ version: 1.1.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-07-19 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
@@ -240,14 +240,18 @@ files:
240
240
  - lib/testlab/container.rb
241
241
  - lib/testlab/container/actions.rb
242
242
  - lib/testlab/container/class_methods.rb
243
+ - lib/testlab/container/clone.rb
244
+ - lib/testlab/container/configuration.rb
243
245
  - lib/testlab/container/generators.rb
244
246
  - lib/testlab/container/interface.rb
245
247
  - lib/testlab/container/io.rb
246
248
  - lib/testlab/container/lifecycle.rb
247
249
  - lib/testlab/container/lxc.rb
248
250
  - lib/testlab/container/method_missing.rb
251
+ - lib/testlab/container/provision.rb
249
252
  - lib/testlab/container/ssh.rb
250
253
  - lib/testlab/container/status.rb
254
+ - lib/testlab/container/support.rb
251
255
  - lib/testlab/container/user.rb
252
256
  - lib/testlab/interface.rb
253
257
  - lib/testlab/labfile.rb
@@ -257,6 +261,7 @@ files:
257
261
  - lib/testlab/network/bind.rb
258
262
  - lib/testlab/network/class_methods.rb
259
263
  - lib/testlab/network/lifecycle.rb
264
+ - lib/testlab/network/provision.rb
260
265
  - lib/testlab/network/status.rb
261
266
  - lib/testlab/node.rb
262
267
  - lib/testlab/node/actions.rb
@@ -264,6 +269,7 @@ files:
264
269
  - lib/testlab/node/lifecycle.rb
265
270
  - lib/testlab/node/lxc.rb
266
271
  - lib/testlab/node/method_missing.rb
272
+ - lib/testlab/node/provision.rb
267
273
  - lib/testlab/node/ssh.rb
268
274
  - lib/testlab/node/status.rb
269
275
  - lib/testlab/provider.rb
@@ -298,6 +304,8 @@ files:
298
304
  - lib/testlab/provisioners/templates/chef/ruby_gem_server.erb
299
305
  - lib/testlab/provisioners/templates/raring/provision.erb
300
306
  - lib/testlab/provisioners/templates/resolv/resolv.conf.erb
307
+ - lib/testlab/support.rb
308
+ - lib/testlab/support/execution.rb
301
309
  - lib/testlab/user.rb
302
310
  - lib/testlab/user/lifecycle.rb
303
311
  - lib/testlab/utility.rb
@@ -331,18 +339,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
331
339
  - - ! '>='
332
340
  - !ruby/object:Gem::Version
333
341
  version: '0'
334
- segments:
335
- - 0
336
- hash: 2056415191929520166
337
342
  required_rubygems_version: !ruby/object:Gem::Requirement
338
343
  none: false
339
344
  requirements:
340
345
  - - ! '>='
341
346
  - !ruby/object:Gem::Version
342
347
  version: '0'
343
- segments:
344
- - 0
345
- hash: 2056415191929520166
346
348
  requirements: []
347
349
  rubyforge_project:
348
350
  rubygems_version: 1.8.25