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 +9 -3
- data/lib/commands/container.rb +41 -0
- data/lib/commands/network.rb +23 -0
- data/lib/commands/node.rb +23 -0
- data/lib/commands/testlab.rb +11 -0
- data/lib/testlab/container/lifecycle.rb +9 -0
- data/lib/testlab/network/lifecycle.rb +9 -0
- data/lib/testlab/node/lifecycle.rb +9 -0
- data/lib/testlab/version.rb +1 -1
- data/lib/testlab.rb +1 -17
- metadata +3 -3
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
|
-
|
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
|
-
|
61
|
-
|
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
|
data/lib/commands/container.rb
CHANGED
@@ -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'
|
data/lib/commands/network.rb
CHANGED
@@ -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)'
|
data/lib/commands/testlab.rb
CHANGED
@@ -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
|
data/lib/testlab/version.rb
CHANGED
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
|
-
|
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.
|
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:
|
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:
|
312
|
+
hash: 805915972640888804
|
313
313
|
requirements: []
|
314
314
|
rubyforge_project:
|
315
315
|
rubygems_version: 1.8.25
|