testlab 0.9.1 → 1.0.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 (52) hide show
  1. data/README.md +26 -20
  2. data/bin/tl +2 -3
  3. data/features/support/Labfile.local +11 -1
  4. data/features/support/Labfile.vagrant +7 -1
  5. data/lib/commands/container.rb +3 -3
  6. data/lib/commands/network.rb +2 -2
  7. data/lib/commands/testlab.rb +15 -15
  8. data/lib/testlab/container/actions.rb +9 -1
  9. data/lib/testlab/container/io.rb +20 -7
  10. data/lib/testlab/container/lifecycle.rb +20 -37
  11. data/lib/testlab/container/lxc.rb +2 -2
  12. data/lib/testlab/container/status.rb +2 -2
  13. data/lib/testlab/container.rb +4 -2
  14. data/lib/testlab/labfile.rb +1 -1
  15. data/lib/testlab/network/actions.rb +40 -4
  16. data/lib/testlab/network/lifecycle.rb +14 -31
  17. data/lib/testlab/network/status.rb +22 -2
  18. data/lib/testlab/node/actions.rb +8 -0
  19. data/lib/testlab/node/lifecycle.rb +14 -35
  20. data/lib/testlab/providers/local.rb +2 -2
  21. data/lib/testlab/providers/vagrant.rb +0 -2
  22. data/lib/testlab/provisioners/apt.rb +2 -2
  23. data/lib/testlab/provisioners/apt_cacher_ng.rb +12 -4
  24. data/lib/testlab/provisioners/bind.rb +23 -11
  25. data/lib/testlab/provisioners/chef/omni_bus.rb +4 -4
  26. data/lib/testlab/provisioners/chef/omni_truck.rb +2 -2
  27. data/lib/testlab/provisioners/chef/ruby_gem_client.rb +4 -4
  28. data/lib/testlab/provisioners/chef/ruby_gem_server.rb +2 -2
  29. data/lib/testlab/provisioners/raring.rb +2 -2
  30. data/lib/testlab/provisioners/resolv.rb +7 -5
  31. data/lib/testlab/provisioners/route.rb +4 -4
  32. data/lib/testlab/provisioners/shell.rb +2 -2
  33. data/lib/testlab/provisioners/templates/apt/bootstrap.erb +2 -2
  34. data/lib/testlab/provisioners/templates/apt_cacher_ng/bootstrap.erb +0 -2
  35. data/lib/testlab/provisioners/templates/apt_cacher_ng/security.conf.erb +1 -0
  36. data/lib/testlab/provisioners/templates/bind/bind-db.erb +1 -1
  37. data/lib/testlab/provisioners/templates/chef/omni_bus.erb +1 -1
  38. data/lib/testlab/provisioners/templates/chef/omni_truck.erb +1 -1
  39. data/lib/testlab/provisioners/templates/chef/ruby_gem_client.erb +1 -1
  40. data/lib/testlab/provisioners/templates/chef/ruby_gem_server.erb +1 -1
  41. data/lib/testlab/provisioners/templates/raring/bootstrap.erb +2 -2
  42. data/lib/testlab/user/lifecycle.rb +2 -2
  43. data/lib/testlab/utility/gli.rb +10 -10
  44. data/lib/testlab/utility/misc.rb +11 -0
  45. data/lib/testlab/version.rb +1 -1
  46. data/lib/testlab.rb +12 -12
  47. data/spec/container_spec.rb +14 -14
  48. data/spec/network_spec.rb +10 -8
  49. data/spec/node_spec.rb +10 -10
  50. data/spec/provisioners/shell_spec.rb +3 -3
  51. data/spec/testlab_spec.rb +12 -12
  52. metadata +5 -4
@@ -18,10 +18,30 @@ class TestLab
18
18
  }
19
19
  end
20
20
 
21
+ # Debian Network 'interfaces' Start Definition Tag
22
+ def def_tag
23
+ "#TESTLAB-DEF-#{self.bridge.to_s.upcase}"
24
+ end
25
+
26
+ # Debian Network 'interfaces' End Definition Tag
27
+ def end_tag
28
+ "#TESTLAB-END-#{self.bridge.to_s.upcase}"
29
+ end
30
+
31
+ # Network IP
32
+ #
33
+ # Returns the IP of the network bridge.
34
+ #
35
+ # @return [String] The network bridge IP address.
21
36
  def ip
22
37
  TestLab::Utility.ip(self.address)
23
38
  end
24
39
 
40
+ # Network CIDR
41
+ #
42
+ # Returns the CIDR of the network bridge.
43
+ #
44
+ # @return [Integer] The network bridge CIDR address.
25
45
  def cidr
26
46
  TestLab::Utility.cidr(self.address)
27
47
  end
@@ -43,11 +63,11 @@ class TestLab
43
63
 
44
64
  # Network Bridge State
45
65
  def state
46
- exit_code = self.node.ssh.exec(%(sudo brctl show #{self.bridge} 2>&1 | grep -i 'No such device'), :silence => true, :ignore_exit_status => true).exit_code
66
+ exit_code = self.node.ssh.exec(%(sudo brctl show #{self.bridge} 2>&1 | grep -i 'No such device'), :ignore_exit_status => true).exit_code
47
67
  if (exit_code == 0)
48
68
  :not_created
49
69
  else
50
- output = self.node.ssh.exec(%(sudo ifconfig #{self.bridge} 2>&1 | grep 'MTU'), :silence => true, :ignore_exit_status => true).output.strip
70
+ output = self.node.ssh.exec(%(sudo ifconfig #{self.bridge} 2>&1 | grep 'MTU'), :ignore_exit_status => true).output.strip
51
71
  if ((output =~ /UP/) || (output =~ /RUNNING/))
52
72
  :running
53
73
  else
@@ -11,6 +11,8 @@ class TestLab
11
11
 
12
12
  please_wait(:ui => @ui, :message => format_object_action(self, 'Create', :green)) do
13
13
  @provider.create
14
+
15
+ do_provisioner_callbacks(self, :create, @ui)
14
16
  end
15
17
 
16
18
  true
@@ -24,6 +26,8 @@ class TestLab
24
26
 
25
27
  please_wait(:ui => @ui, :message => format_object_action(self, 'Destroy', :red)) do
26
28
  @provider.destroy
29
+
30
+ do_provisioner_callbacks(self, :destroy, @ui)
27
31
  end
28
32
 
29
33
  true
@@ -37,6 +41,8 @@ class TestLab
37
41
 
38
42
  please_wait(:ui => @ui, :message => format_object_action(self, 'Up', :green)) do
39
43
  @provider.up
44
+
45
+ do_provisioner_callbacks(self, :up, @ui)
40
46
  end
41
47
 
42
48
  true
@@ -50,6 +56,8 @@ class TestLab
50
56
 
51
57
  please_wait(:ui => @ui, :message => format_object_action(self, 'Down', :red)) do
52
58
  @provider.down
59
+
60
+ do_provisioner_callbacks(self, :down, @ui)
53
61
  end
54
62
 
55
63
  true
@@ -3,43 +3,27 @@ class TestLab
3
3
 
4
4
  module Lifecycle
5
5
 
6
- # Bootstrap the node
7
- def node_setup
8
- node_setup_template = File.join(self.class.template_dir, 'node-setup.erb')
9
- self.ssh.bootstrap(ZTK::Template.render(node_setup_template))
10
- end
11
-
12
- # Setup the node.
13
- def setup
14
- @ui.logger.debug { "Node Setup: #{self.id} " }
6
+ # Provision the node.
7
+ def provision
8
+ @ui.logger.debug { "Node Provision: #{self.id} " }
15
9
 
16
- please_wait(:ui => @ui, :message => format_object_action(self, 'Setup', :green)) do
17
-
18
- self.all_provisioners.each do |provisioner|
19
- @ui.logger.info { ">>>>> NODE PROVISIONER SETUP: #{provisioner} (#{self.id}) <<<<<" }
20
- p = provisioner.new(self.config, @ui)
21
- p.respond_to?(:on_node_setup) and p.on_node_setup(self)
22
- end
10
+ (self.state != :running) and return false
23
11
 
12
+ please_wait(:ui => @ui, :message => format_object_action(self, 'Provision', :green)) do
13
+ do_provisioner_callbacks(self, :provision, @ui)
24
14
  end
25
15
 
26
16
  true
27
17
  end
28
18
 
29
- # Teardown the node.
30
- def teardown
31
- @ui.logger.debug { "Node Teardown: #{self.id} " }
32
-
33
- (self.state == :not_created) and return false
19
+ # Deprovision the node.
20
+ def deprovision
21
+ @ui.logger.debug { "Node Deprovision: #{self.id} " }
34
22
 
35
- please_wait(:ui => @ui, :message => format_object_action(self, 'Teardown', :red)) do
36
-
37
- self.all_provisioners.each do |provisioner|
38
- @ui.logger.info { ">>>>> NODE PROVISIONER TEARDOWN: #{provisioner} (#{self.id}) <<<<<" }
39
- p = provisioner.new(self.config, @ui)
40
- p.respond_to?(:on_node_teardown) and p.on_node_teardown(self)
41
- end
23
+ (self.state != :running) and return false
42
24
 
25
+ please_wait(:ui => @ui, :message => format_object_action(self, 'Deprovision', :red)) do
26
+ do_provisioner_callbacks(self, :deprovision, @ui)
43
27
  end
44
28
 
45
29
  true
@@ -49,25 +33,20 @@ class TestLab
49
33
  def build
50
34
  self.create
51
35
  self.up
52
- self.setup
36
+ self.provision
53
37
 
54
38
  true
55
39
  end
56
40
 
57
41
  # Demolish the node
58
42
  def demolish
59
- self.teardown
43
+ self.deprovision
60
44
  self.down
61
45
  self.destroy
62
46
 
63
47
  true
64
48
  end
65
49
 
66
- # Returns all defined provisioners for this node and it's networks and containers.
67
- def all_provisioners
68
- [self.provisioners, self.networks.map(&:provisioners), self.containers.map(&:provisioners)].flatten.compact.uniq
69
- end
70
-
71
50
  end
72
51
  end
73
52
  end
@@ -71,11 +71,11 @@ class TestLab
71
71
  end
72
72
 
73
73
  def user
74
- ENV['USER']
74
+ (@config[:local][:user] || ENV['USER'])
75
75
  end
76
76
 
77
77
  def identity
78
- File.join(ENV['HOME'], ".ssh", "id_rsa")
78
+ (@config[:local][:identity] || File.join(ENV['HOME'], ".ssh", "id_rsa"))
79
79
  end
80
80
 
81
81
  def ip
@@ -45,8 +45,6 @@ class TestLab
45
45
 
46
46
  # Create the Vagrant instance
47
47
  def create
48
- self.up
49
-
50
48
  true
51
49
  end
52
50
 
@@ -21,12 +21,12 @@ class TestLab
21
21
  @ui.logger.debug { "config(#{@config.inspect})" }
22
22
  end
23
23
 
24
- # APT Provisioner Container Setup
24
+ # APT: Container Provision
25
25
  #
26
26
  # @param [TestLab::Container] container The container which we want to
27
27
  # provision.
28
28
  # @return [Boolean] True if successful.
29
- def on_container_setup(container)
29
+ def on_container_provision(container)
30
30
  @ui.logger.debug { "APT Provisioner: Container #{container.id}" }
31
31
 
32
32
  bootstrap_template = File.join(TestLab::Provisioner.template_dir, "apt", "bootstrap.erb")
@@ -19,15 +19,16 @@ class TestLab
19
19
  @config[:apt][:cacher_ng][:exclude_hosts] ||= Array.new
20
20
 
21
21
  @apt_conf_d_proxy_file_template = File.join(TestLab::Provisioner.template_dir, "apt_cacher_ng", "00proxy.erb")
22
+ @apt_cacher_ng_security_conf_template = File.join(TestLab::Provisioner.template_dir, "apt_cacher_ng", "security.conf.erb")
22
23
 
23
24
  @ui.logger.debug { "config(#{@config.inspect})" }
24
25
  end
25
26
 
26
- # APT-CacherNG Provisioner Node Setup
27
+ # APT-CacherNG: Node Provision
27
28
  #
28
29
  # @param [TestLab::Node] node The node which we want to provision.
29
30
  # @return [Boolean] True if successful.
30
- def on_node_setup(node)
31
+ def on_node_provision(node)
31
32
  @ui.logger.debug { "APT-CacherNG Provisioner: Node #{node.id}" }
32
33
 
33
34
  bootstrap_template = File.join(TestLab::Provisioner.template_dir, "apt_cacher_ng", "bootstrap.erb")
@@ -47,15 +48,22 @@ class TestLab
47
48
  file.puts(ZTK::Template.render(@apt_conf_d_proxy_file_template, context))
48
49
  end
49
50
 
51
+ apt_cacher_ng_security_conf_file = %(/etc/apt-cacher-ng/security.conf)
52
+ node.ssh.file(:target => apt_cacher_ng_security_conf_file, :chown => "root:root", :chmod => "0644") do |file|
53
+ file.puts(ZTK::Template.render(@apt_cacher_ng_security_conf_template, context))
54
+ end
55
+
56
+ node.ssh.exec(%(sudo service apt-cacher-ng restart))
57
+
50
58
  true
51
59
  end
52
60
 
53
- # APT-CacherNG Provisioner Container Setup
61
+ # APT-CacherNG: Container Provision
54
62
  #
55
63
  # @param [TestLab::Container] container The container which we want to
56
64
  # provision.
57
65
  # @return [Boolean] True if successful.
58
- def on_container_setup(container)
66
+ def on_container_provision(container)
59
67
  @ui.logger.debug { "APT-CacherNG Provisioner: Container #{container.id}" }
60
68
 
61
69
  # Ensure the container APT calls use apt-cacher-ng on the node
@@ -20,14 +20,26 @@ class TestLab
20
20
  @ui.logger.debug { "config(#{@config.inspect})" }
21
21
  end
22
22
 
23
- # Bind Provisioner Node Setup
23
+ # Bind: Node Provision
24
24
  #
25
- # @param [TestLab::Node] node The node which we want to provision.
25
+ # @param [TestLab::Node] node The node that is being provisioned.
26
26
  # @return [Boolean] True if successful.
27
- def on_node_setup(node)
27
+ def on_node_provision(node)
28
28
  @ui.logger.debug { "BIND Provisioner: Node #{node.id}" }
29
29
 
30
- bind_setup(node.ssh)
30
+ bind_provision(node)
31
+
32
+ true
33
+ end
34
+
35
+ # Bind: Network Up
36
+ #
37
+ # @param [TestLab::Network] network The network that is being onlined.
38
+ # @return [Boolean] True if successful.
39
+ def on_network_up(network)
40
+ @ui.logger.debug { "BIND Provisioner: Network #{network.id}" }
41
+
42
+ bind_reload(network.node)
31
43
 
32
44
  true
33
45
  end
@@ -112,15 +124,15 @@ class TestLab
112
124
  ssh.exec(%(sudo rm -fv /etc/bind/{*.arpa,*.zone,*.conf*}))
113
125
  end
114
126
 
115
- def bind_reload(ssh)
116
- ssh.exec(%(sudo chown -Rv bind:bind /etc/bind))
117
- ssh.exec(%(sudo rndc reload))
127
+ def bind_reload(node)
128
+ node.ssh.exec(%(sudo chown -Rv bind:bind /etc/bind))
129
+ node.ssh.exec(%(sudo rndc reload))
118
130
  end
119
131
 
120
- def bind_setup(ssh)
121
- bind_install(ssh)
122
- build_bind_conf(ssh)
123
- bind_reload(ssh)
132
+ def bind_provision(node)
133
+ bind_install(node.ssh)
134
+ build_bind_conf(node.ssh)
135
+ bind_reload(node)
124
136
  end
125
137
 
126
138
  end
@@ -26,7 +26,7 @@ class TestLab
26
26
  @ui.logger.debug { "config(#{@config.inspect})" }
27
27
  end
28
28
 
29
- # OmniBus Provisioner Container Setup
29
+ # OmniBus: Container Provision
30
30
  #
31
31
  # Renders the defined script to a temporary file on the target container
32
32
  # and proceeds to execute said script as root via *lxc-attach*.
@@ -34,7 +34,7 @@ class TestLab
34
34
  # @param [TestLab::Container] container The container which we want to
35
35
  # provision.
36
36
  # @return [Boolean] True if successful.
37
- def on_container_setup(container)
37
+ def on_container_provision(container)
38
38
  @config[:chef][:client][:node_name] ||= container.id
39
39
 
40
40
  omnibus_template = File.join(TestLab::Provisioner::Chef.template_dir, 'omni_bus.erb')
@@ -54,10 +54,10 @@ class TestLab
54
54
  true
55
55
  end
56
56
 
57
- # OmniBus Provisioner Container Teardown
57
+ # OmniBus: Container Deprovision
58
58
  #
59
59
  # @return [Boolean] True if successful.
60
- def on_container_teardown(container)
60
+ def on_container_deprovision(container)
61
61
  if @chef_server.state == :running
62
62
  @chef_server.ssh.exec(%(knife node delete #{container.id} --yes), :ignore_exit_status => true)
63
63
  @chef_server.ssh.exec(%(knife client delete #{container.id} --yes), :ignore_exit_status => true)
@@ -25,7 +25,7 @@ class TestLab
25
25
  @ui.logger.debug { "config(#{@config.inspect})" }
26
26
  end
27
27
 
28
- # OmniTruck Provisioner Container Setup
28
+ # OmniTruck: Container Provision
29
29
  #
30
30
  # Renders the defined script to a temporary file on the target container
31
31
  # and proceeds to execute said script as root via *lxc-attach*.
@@ -33,7 +33,7 @@ class TestLab
33
33
  # @param [TestLab::Container] container The container which we want to
34
34
  # provision.
35
35
  # @return [Boolean] True if successful.
36
- def on_container_setup(container)
36
+ def on_container_provision(container)
37
37
  omnitruck_template = File.join(TestLab::Provisioner::Chef.template_dir, 'omni_truck.erb')
38
38
 
39
39
  config = {}.merge!({
@@ -27,7 +27,7 @@ class TestLab
27
27
  @ui.logger.debug { "config(#{@config.inspect})" }
28
28
  end
29
29
 
30
- # RubyGemClient Provisioner Container Setup
30
+ # RubyGemClient: Container Provision
31
31
  #
32
32
  # Renders the defined script to a temporary file on the target container
33
33
  # and proceeds to execute said script as root via *lxc-attach*.
@@ -35,7 +35,7 @@ class TestLab
35
35
  # @param [TestLab::Container] container The container which we want to
36
36
  # provision.
37
37
  # @return [Boolean] True if successful.
38
- def on_container_setup(container)
38
+ def on_container_provision(container)
39
39
  @config[:chef][:client][:node_name] ||= container.id
40
40
 
41
41
  rubygem_client_template = File.join(TestLab::Provisioner::Chef.template_dir, 'ruby_gem_client.erb')
@@ -55,10 +55,10 @@ class TestLab
55
55
  true
56
56
  end
57
57
 
58
- # RubyGemClient Provisioner Container Teardown
58
+ # RubyGemClient: Container Deprovision
59
59
  #
60
60
  # @return [Boolean] True if successful.
61
- def on_container_teardown(container)
61
+ def on_container_deprovision(container)
62
62
  if @chef_server.state == :running
63
63
  @chef_server.ssh.exec(%(knife node delete #{container.id} --yes), :ignore_exit_status => true)
64
64
  @chef_server.ssh.exec(%(knife client delete #{container.id} --yes), :ignore_exit_status => true)
@@ -23,7 +23,7 @@ class TestLab
23
23
  @ui.logger.debug { "config(#{@config.inspect})" }
24
24
  end
25
25
 
26
- # RubyGemServer Provisioner Container Setup
26
+ # RubyGemServer: Container Provision
27
27
  #
28
28
  # Renders the defined script to a temporary file on the target container
29
29
  # and proceeds to execute said script as root via *lxc-attach*.
@@ -31,7 +31,7 @@ class TestLab
31
31
  # @param [TestLab::Container] container The container which we want to
32
32
  # provision.
33
33
  # @return [Boolean] True if successful.
34
- def on_container_setup(container)
34
+ def on_container_provision(container)
35
35
  rubygemserver_template = File.join(TestLab::Provisioner.template_dir, 'chef', 'ruby_gem_server.erb')
36
36
 
37
37
  config = {}.merge!({
@@ -19,12 +19,12 @@ class TestLab
19
19
  @ui.logger.debug { "config(#{@config.inspect})" }
20
20
  end
21
21
 
22
- # Ubuntu Raring Provisioner Node Setup
22
+ # Ubuntu Raring: Node Provision
23
23
  #
24
24
  # @param [TestLab::Node] node The node which we want to
25
25
  # provision.
26
26
  # @return [Boolean] True if successful.
27
- def on_node_setup(node)
27
+ def on_node_provision(node)
28
28
  @ui.logger.debug { "Ubuntu Raring Provisioner: Node #{node.id}" }
29
29
 
30
30
  bootstrap_template = File.join(TestLab::Provisioner.template_dir, "raring", "bootstrap.erb")
@@ -15,30 +15,32 @@ class TestLab
15
15
  @ui = (ui || TestLab.ui)
16
16
 
17
17
  @config[:resolv] ||= Hash.new
18
- @config[:resolv][:servers] ||= [TestLab::Network.ips, "8.8.8.8", "8.8.4.4" ].flatten.compact.uniq
18
+ @config[:resolv][:servers] ||= [TestLab::Network.ips, '8.8.8.8', '8.8.4.4'].flatten.compact.uniq
19
19
  @config[:resolv][:search] ||= TestLab::Container.domains.join(' ')
20
20
 
21
21
  @ui.logger.debug { "config(#{@config.inspect})" }
22
22
  end
23
23
 
24
- # Resolv Provisioner Node Setup
24
+ # Resolv: Node Provision
25
25
  #
26
26
  # @param [TestLab::Node] node The node which we want to provision.
27
27
  # @return [Boolean] True if successful.
28
- def on_node_setup(node)
28
+ def on_node_provision(node)
29
29
  @ui.logger.debug { "RESOLV Provisioner: Node #{node.id}" }
30
30
 
31
+ @config[:resolv][:servers] = ['127.0.0.1', '8.8.8.8', '8.8.4.4']
32
+
31
33
  render_resolv_conf(node)
32
34
 
33
35
  true
34
36
  end
35
37
 
36
- # Resolv Provisioner Container Setup
38
+ # Resolv: Container Provision
37
39
  #
38
40
  # @param [TestLab::Container] container The container which we want to
39
41
  # provision.
40
42
  # @return [Boolean] True if successful.
41
- def on_container_setup(container)
43
+ def on_container_provision(container)
42
44
  @ui.logger.debug { "RESOLV Provisioner: Container #{container.id}" }
43
45
 
44
46
  render_resolv_conf(container)
@@ -19,15 +19,15 @@ class TestLab
19
19
  @ui.logger.debug { "config(#{@config.inspect})" }
20
20
  end
21
21
 
22
- # Route Provisioner Network Setup
23
- def on_network_setup(network)
22
+ # Route: Network Provision
23
+ def on_network_provision(network)
24
24
  manage_route(:add, network)
25
25
 
26
26
  true
27
27
  end
28
28
 
29
- # Route Provisioner Network Teardown
30
- def on_network_teardown(network)
29
+ # Route: Network Deprovision
30
+ def on_network_deprovision(network)
31
31
  manage_route(:del, network)
32
32
 
33
33
  true
@@ -16,7 +16,7 @@ class TestLab
16
16
  @config = (config || Hash.new)
17
17
  end
18
18
 
19
- # Shell Provisioner Container Setup
19
+ # Shell: Container Provision
20
20
  #
21
21
  # Renders the defined script to a temporary file on the target container
22
22
  # and proceeds to execute said script as root via *lxc-attach*.
@@ -24,7 +24,7 @@ class TestLab
24
24
  # @param [TestLab::Container] container The container which we want to
25
25
  # provision.
26
26
  # @return [Boolean] True if successful.
27
- def on_container_setup(container)
27
+ def on_container_provision(container)
28
28
  @config[:script].nil? and raise ShellError, "You must supply a script to bootstrap!"
29
29
 
30
30
  container.bootstrap(@config[:script])
@@ -1,7 +1,7 @@
1
1
  set -x
2
2
  set -e
3
3
 
4
- [[ -f /.testlab-apt-bootstrap ]] && exit 0
4
+ [[ -f /.testlab-apt-provision ]] && exit 0
5
5
 
6
6
  export DEBIAN_FRONTEND="noninteractive"
7
7
 
@@ -13,4 +13,4 @@ apt-get -y install <%= @apt[:install].flatten.compact.join(' ') %>
13
13
  apt-get -y remove <%= @apt[:remove].flatten.compact.join(' ') %>
14
14
  <% end -%>
15
15
 
16
- touch /.testlab-apt-bootstrap
16
+ touch /.testlab-apt-provision
@@ -6,5 +6,3 @@ export DEBIAN_FRONTEND="noninteractive"
6
6
  apt-get -y install apt-cacher-ng
7
7
  service apt-cacher-ng restart || service apt-cacher-ng start
8
8
  grep "^MIRROR" /etc/default/lxc || echo 'MIRROR="http://127.0.0.1:3142/archive.ubuntu.com/ubuntu"' | tee -a /etc/default/lxc
9
-
10
- # && service lxc restart || service lxc start
@@ -0,0 +1 @@
1
+ AdminAuth: admin:admin
@@ -1,6 +1,6 @@
1
1
  $TTL 1d
2
2
  @ IN SOA localhost. root.localhost. (
3
- <%= Time.now.to_i %> ; Serial
3
+ <%= Time.now.utc.to_i %> ; Serial
4
4
  1w ; Refresh
5
5
  1d ; Retry
6
6
  4w ; Expire
@@ -33,4 +33,4 @@ EOF
33
33
 
34
34
  <%= @chef_client_cli %>
35
35
 
36
- touch /.omni-bus-bootstrap
36
+ touch /.omni-bus-provision
@@ -78,4 +78,4 @@ chmod -v +x ${KNIFE_CONFIG_EXP_FILE}
78
78
 
79
79
  chown -Rv ${SUDO_USER}:${SUDO_USER} ${HOME}
80
80
 
81
- touch /.omni-truck-bootstrap
81
+ touch /.omni-truck-provision
@@ -43,4 +43,4 @@ EOF
43
43
 
44
44
  <%= @chef_client_cli %>
45
45
 
46
- touch /.ruby-gem-client-bootstrap
46
+ touch /.ruby-gem-client-provision
@@ -76,4 +76,4 @@ cp -v <%= @chef_validator %> <%= @chef_webui %> ~/.chef
76
76
 
77
77
  chown -Rv ${SUDO_USER}:${SUDO_USER} ${HOME}
78
78
 
79
- touch /.ruby-gem-server-bootstrap
79
+ touch /.ruby-gem-server-provision
@@ -3,12 +3,12 @@ set -e
3
3
 
4
4
  export DEBIAN_FRONTEND="noninteractive"
5
5
 
6
- if [ ! -f /.testlab-raring-bootstrap ]; then
6
+ if [ ! -f /.testlab-raring-provision ]; then
7
7
  # Update APT and ensure our required packages are installed
8
8
  apt-get -y update
9
9
  apt-get -y install lxc bridge-utils debootstrap yum iptables ntpdate ntp pbzip2
10
10
 
11
- touch /.testlab-raring-bootstrap
11
+ touch /.testlab-raring-provision
12
12
  fi
13
13
 
14
14
  # Ensure the default lxc networking services are off
@@ -3,10 +3,10 @@ class TestLab
3
3
 
4
4
  module Lifecycle
5
5
 
6
- # Setup the user
6
+ # Provision the user
7
7
  #
8
8
  # @return [Boolean] True if successful.
9
- def setup
9
+ def provision
10
10
  @ui.logger.debug { "User Create: #{self.username} " }
11
11
 
12
12
  node_home_dir = ((self.container.node.user == "root") ? %(/root) : %(/home/#{self.container.node.user}))
@@ -7,28 +7,28 @@ class TestLab
7
7
  module GLI
8
8
  require 'ztk'
9
9
 
10
- LAB_ACTION_ORDER = %W(create destroy up down setup teardown build demolish).map(&:to_sym)
10
+ LAB_ACTION_ORDER = %W(create destroy up down provision deprovision build demolish).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 %>."],
15
- :up => ["On-line %s", "Attempts to online the <%= @component %>."],
16
- :down => ["Off-line %s", "Attempts to offline the <%= @component %>."],
17
- :setup => ["Provision %s", "Attempts to provision the <%= @component %>."],
18
- :teardown => ["De-provision %s", "Attempts to deprovision the <%= @component %>."],
19
- :build => ["Build %s", <<-EOF],
13
+ :create => ["Construct %s", "Attempts to create the <%= @component %>."],
14
+ :destroy => ["Destruct %s", "Attempts to destroy the <%= @component %>."],
15
+ :up => ["On-line %s", "Attempts to online the <%= @component %>."],
16
+ :down => ["Off-line %s", "Attempts to offline the <%= @component %>."],
17
+ :provision => ["Provision %s", "Attempts to provision the <%= @component %>."],
18
+ :deprovision => ["De-provision %s", "Attempts to deprovision the <%= @component %>."],
19
+ :build => ["Build %s", <<-EOF],
20
20
  Attempts to build the <%= @component %>. TestLab will attempt to create, online and provision the <%= @component %>.
21
21
 
22
22
  The <%= @component %> are taken through the following states:
23
23
 
24
- Create -> Up -> Setup
24
+ Create -> Up -> Provision
25
25
  EOF
26
26
  :demolish => ["Demolish %s", <<-EOF]
27
27
  Attempts to demolish the <%= @component %>. TestLab will attempt to deprovision, offline and destroy the <%= @component %>.
28
28
 
29
29
  The <%= @component %> are taken through the following states:
30
30
 
31
- Teardown -> Down -> Destroy
31
+ Deprovision -> Down -> Destroy
32
32
  EOF
33
33
  }
34
34
 
@@ -44,6 +44,17 @@ class TestLab
44
44
  end
45
45
  end
46
46
 
47
+ def do_provisioner_callbacks(object, action, ui)
48
+ klass = object.class.to_s.split('::').last
49
+ method_name = %(on_#{klass.downcase}_#{action.to_s.downcase}).to_sym
50
+
51
+ object.provisioners.each do |provisioner|
52
+ ui.logger.info { ">>>>> #{object.id.to_s.upcase} #{klass.upcase} #{action.to_s.upcase} [#{method_name}] (#{provisioner}) <<<<<" }
53
+ p = provisioner.new(object.config, ui)
54
+ p.respond_to?(method_name) and p.send(method_name, object)
55
+ end
56
+ end
57
+
47
58
  end
48
59
 
49
60
  end