testlab 0.6.8 → 0.6.9

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
@@ -42,8 +42,12 @@ desc 'Show verbose output'
42
42
  default_value false
43
43
  switch [:v, :verbose]
44
44
 
45
+ desc 'Quiet mode'
46
+ default_value false
47
+ switch [:q, :quiet]
48
+
45
49
  pre do |global,command,options,args|
46
- global[:v].nil? or (global[:v] == true) and ENV['LOG_LEVEL'] = 'DEBUG'
50
+ (global[:v] == true) and ENV['LOG_LEVEL'] = 'DEBUG'
47
51
 
48
52
  log_file = File.join(Dir.pwd, "testlab-#{HOSTNAME}.log")
49
53
  @logger = ZTK::Logger.new(log_file)
@@ -57,8 +61,10 @@ pre do |global,command,options,args|
57
61
 
58
62
  TestLab::Utility.log_header(@testlab).each { |line| @logger.info { line } }
59
63
 
60
- message = format_message("TestLab v#{TestLab::VERSION} Loaded".black.bold)
61
- @testlab.ui.stdout.puts(message)
64
+ if (global[:q] == false)
65
+ message = format_message("TestLab v#{TestLab::VERSION} Loaded".black.bold)
66
+ @testlab.ui.stdout.puts(message)
67
+ end
62
68
 
63
69
  true
64
70
  end
@@ -142,6 +142,29 @@ EOF
142
142
  end
143
143
  end
144
144
 
145
+ # CONTAINER BUILD
146
+ ##################
147
+ c.desc 'Build a container'
148
+ c.long_desc <<-EOF
149
+ Attempts to build up the container. TestLab will attempt to create, online and provision the container.
150
+
151
+ The container is taken through the following phases:
152
+
153
+ Create -> Up -> Setup
154
+ EOF
155
+ c.command :build do |build|
156
+ build.action do |global_options, options, args|
157
+ if options[:name].nil?
158
+ help_now!('a name is required') if options[:name].nil?
159
+ else
160
+ container = @testlab.containers.select{ |c| c.id.to_sym == options[:name].to_sym }.first
161
+ container.nil? and raise TestLab::TestLabError, "We could not find the container you supplied!"
162
+
163
+ container.build
164
+ end
165
+ end
166
+ end
167
+
145
168
  # CONTAINER STATUS
146
169
  ###################
147
170
  c.desc 'Display the status of container(s)'
@@ -201,6 +224,24 @@ EOF
201
224
  end
202
225
  end
203
226
 
227
+ # CONTAINER SSH-CONFIG
228
+ #######################
229
+ c.desc 'Display the SSH configuration for a container'
230
+ c.long_desc <<-EOF
231
+ Displays the SSH configuration for the supplied container name.
232
+ EOF
233
+ c.command :'ssh-config' do |ssh_config|
234
+
235
+ ssh_config.action do |global_options, options, args|
236
+ help_now!('a name is required') if options[:name].nil?
237
+
238
+ container = @testlab.containers.select{ |n| n.id.to_sym == options[:name].to_sym }.first
239
+ container.nil? and raise TestLab::TestLabError, "We could not find the container you supplied!"
240
+
241
+ puts(container.ssh_config)
242
+ end
243
+ end
244
+
204
245
  # CONTAINER RECYCLE
205
246
  ####################
206
247
  c.desc 'Recycles a container'
@@ -142,6 +142,29 @@ EOF
142
142
  end
143
143
  end
144
144
 
145
+ # NETWORK BUILD
146
+ ################
147
+ c.desc 'Build a network'
148
+ c.long_desc <<-EOF
149
+ Attempts to build up the network. TestLab will attempt to create, online and provision the network.
150
+
151
+ The network is taken through the following phases:
152
+
153
+ Create -> Up -> Setup
154
+ EOF
155
+ c.command :build do |build|
156
+ build.action do |global_options, options, args|
157
+ if options[:name].nil?
158
+ help_now!('a name is required') if options[:name].nil?
159
+ else
160
+ network = @testlab.networks.select{ |c| c.id.to_sym == options[:name].to_sym }.first
161
+ network.nil? and raise TestLab::TestLabError, "We could not find the network you supplied!"
162
+
163
+ network.build
164
+ end
165
+ end
166
+ end
167
+
145
168
  # NETWORK STATUS
146
169
  #################
147
170
  c.desc 'Display the status of network(s)'
data/lib/commands/node.rb CHANGED
@@ -142,6 +142,29 @@ EOF
142
142
  end
143
143
  end
144
144
 
145
+ # NODE BUILD
146
+ #############
147
+ c.desc 'Build a node'
148
+ c.long_desc <<-EOF
149
+ Attempts to build up the node. TestLab will attempt to create, online and provision the node.
150
+
151
+ The node is taken through the following phases:
152
+
153
+ Create -> Up -> Setup
154
+ EOF
155
+ c.command :build do |build|
156
+ build.action do |global_options, options, args|
157
+ if options[:name].nil?
158
+ help_now!('a name is required') if options[:name].nil?
159
+ else
160
+ node = @testlab.nodes.select{ |c| c.id.to_sym == options[:name].to_sym }.first
161
+ node.nil? and raise TestLab::TestLabError, "We could not find the node you supplied!"
162
+
163
+ node.build
164
+ end
165
+ end
166
+ end
167
+
145
168
  # NODE STATUS
146
169
  ##############
147
170
  c.desc 'Display the status of node(s)'
@@ -75,6 +75,17 @@ end
75
75
  # LAB BUILD
76
76
  ############
77
77
  desc 'Build the test lab infrastructure'
78
+ long_desc <<-EOF
79
+ Attempts to build the defined test lab. TestLab will attempt to create, online and provision the lab components.
80
+
81
+ The components are built in the following order:
82
+
83
+ Nodes -> Networks -> Containers
84
+
85
+ TestLab will then attempt to build the componenets executing the following tasks for each:
86
+
87
+ Create -> Up -> Setup
88
+ EOF
78
89
  command :build do |build|
79
90
  build.action do |global_options,options,args|
80
91
  @testlab.build
@@ -51,6 +51,15 @@ class TestLab
51
51
  true
52
52
  end
53
53
 
54
+ # Build the container
55
+ def build
56
+ self.create
57
+ self.up
58
+ self.setup
59
+
60
+ true
61
+ end
62
+
54
63
  end
55
64
 
56
65
  end
@@ -37,6 +37,15 @@ class TestLab
37
37
  true
38
38
  end
39
39
 
40
+ # Build the network
41
+ def build
42
+ self.create
43
+ self.up
44
+ self.setup
45
+
46
+ true
47
+ end
48
+
40
49
  end
41
50
 
42
51
  end
@@ -45,6 +45,15 @@ class TestLab
45
45
  true
46
46
  end
47
47
 
48
+ # Build the node
49
+ def build
50
+ self.create
51
+ self.up
52
+ self.setup
53
+
54
+ true
55
+ end
56
+
48
57
  def global_provisioners
49
58
  [self.provisioners, self.containers.map(&:provisioners)].flatten.compact.uniq
50
59
  end
@@ -1,6 +1,6 @@
1
1
  class TestLab
2
2
  unless const_defined?(:VERSION)
3
3
  # TestLab Gem Version
4
- VERSION = "0.6.8"
4
+ VERSION = "0.6.9"
5
5
  end
6
6
  end
data/lib/testlab.rb CHANGED
@@ -219,23 +219,7 @@ class TestLab
219
219
  #
220
220
  # @return [Boolean] True if successful.
221
221
  def build
222
- nodes.each do |node|
223
- node.create
224
- node.up
225
- node.setup
226
-
227
- node.networks.each do |network|
228
- network.create
229
- network.up
230
- network.setup
231
- end
232
-
233
- node.containers.each do |container|
234
- container.create
235
- container.up
236
- container.setup
237
- end
238
- end
222
+ method_proxy(:build)
239
223
 
240
224
  true
241
225
  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: 0.6.8
4
+ version: 0.6.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -300,7 +300,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
300
  version: '0'
301
301
  segments:
302
302
  - 0
303
- hash: 1538648921136541642
303
+ hash: 805915972640888804
304
304
  required_rubygems_version: !ruby/object:Gem::Requirement
305
305
  none: false
306
306
  requirements:
@@ -309,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
309
  version: '0'
310
310
  segments:
311
311
  - 0
312
- hash: 1538648921136541642
312
+ hash: 805915972640888804
313
313
  requirements: []
314
314
  rubyforge_project:
315
315
  rubygems_version: 1.8.25