testlab 0.4.1 → 0.4.2
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 +39 -32
- data/lib/testlab/network/lifecycle.rb +10 -11
- data/lib/testlab/providers/vagrant.rb +1 -2
- data/lib/testlab/provisioners/omnibus.rb +2 -0
- data/lib/testlab/provisioners/omnitruck.rb +2 -0
- data/lib/testlab/provisioners/templates/chef/omnibus.erb +1 -1
- data/lib/testlab/version.rb +1 -1
- metadata +4 -4
data/bin/tl
CHANGED
|
@@ -161,6 +161,45 @@ command :network do |c|
|
|
|
161
161
|
c.arg_name 'network'
|
|
162
162
|
c.flag [:i, :id]
|
|
163
163
|
|
|
164
|
+
|
|
165
|
+
# ROUTES
|
|
166
|
+
#########
|
|
167
|
+
c.desc 'Manage routes'
|
|
168
|
+
c.command :route do |route|
|
|
169
|
+
|
|
170
|
+
# ROUTE ADD
|
|
171
|
+
############
|
|
172
|
+
route.desc 'Add routes to lab networks'
|
|
173
|
+
route.command :add do |add|
|
|
174
|
+
add.action do |global_options,options,args|
|
|
175
|
+
help_now!('id is required') if options[:id].nil?
|
|
176
|
+
|
|
177
|
+
network = @testlab.networks.select{ |c| c.id.to_sym == options[:id].to_sym }.first
|
|
178
|
+
network.nil? and raise TestLab::TestLabError, "We could not find the network you supplied!"
|
|
179
|
+
|
|
180
|
+
network.manage_route(:add)
|
|
181
|
+
@testlab.ui.stdout.puts("Added routes successfully!".green.bold)
|
|
182
|
+
@testlab.ui.stdout.puts %x(netstat -nr | grep '#{network.node.ip}').strip
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# ROUTE DEL
|
|
187
|
+
############
|
|
188
|
+
route.desc 'Delete routes to lab networks'
|
|
189
|
+
route.command :del do |del|
|
|
190
|
+
del.action do |global_options,options,args|
|
|
191
|
+
help_now!('id is required') if options[:id].nil?
|
|
192
|
+
|
|
193
|
+
network = @testlab.networks.select{ |c| c.id.to_sym == options[:id].to_sym }.first
|
|
194
|
+
network.nil? and raise TestLab::TestLabError, "We could not find the network you supplied!"
|
|
195
|
+
|
|
196
|
+
network.manage_route(:del)
|
|
197
|
+
@testlab.ui.stdout.puts("Deleted routes successfully!".red.bold)
|
|
198
|
+
@testlab.ui.stdout.puts %x(netstat -nr | grep '#{network.node.ip}').strip
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
164
203
|
# NETWORK STATUS
|
|
165
204
|
#################
|
|
166
205
|
c.desc 'Display the status of network(s)'
|
|
@@ -309,38 +348,6 @@ EOF
|
|
|
309
348
|
|
|
310
349
|
end
|
|
311
350
|
|
|
312
|
-
# ROUTES
|
|
313
|
-
#########
|
|
314
|
-
desc 'Manage routes'
|
|
315
|
-
command :route do |c|
|
|
316
|
-
|
|
317
|
-
# ROUTE ADD
|
|
318
|
-
############
|
|
319
|
-
c.desc 'Add routes to lab networks'
|
|
320
|
-
c.command :add do |add|
|
|
321
|
-
add.action do |global_options,options,args|
|
|
322
|
-
@testlab.nodes.each do |node|
|
|
323
|
-
node.route_setup(:add)
|
|
324
|
-
@testlab.ui.stdout.puts("Added routes successfully!".green.bold)
|
|
325
|
-
@testlab.ui.stdout.puts %x(netstat -nr | grep '#{node.ip}').strip
|
|
326
|
-
end
|
|
327
|
-
end
|
|
328
|
-
end
|
|
329
|
-
|
|
330
|
-
# ROUTE DEL
|
|
331
|
-
############
|
|
332
|
-
c.desc 'Delete routes to lab networks'
|
|
333
|
-
c.command :del do |del|
|
|
334
|
-
del.action do |global_options,options,args|
|
|
335
|
-
@testlab.nodes.each do |node|
|
|
336
|
-
node.route_setup(:del)
|
|
337
|
-
@testlab.ui.stdout.puts("Deleted routes successfully!".red.bold)
|
|
338
|
-
@testlab.ui.stdout.puts %x(netstat -nr | grep '#{node.ip}').strip
|
|
339
|
-
end
|
|
340
|
-
end
|
|
341
|
-
end
|
|
342
|
-
end
|
|
343
|
-
|
|
344
351
|
pre do |global,command,options,args|
|
|
345
352
|
# Pre logic here
|
|
346
353
|
# Return true to proceed; false to abort and not call the
|
|
@@ -9,28 +9,27 @@ class TestLab
|
|
|
9
9
|
|
|
10
10
|
self.create
|
|
11
11
|
self.up
|
|
12
|
-
self.route and
|
|
12
|
+
self.route and manage_route(:add)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# Network Teardown
|
|
16
16
|
def teardown
|
|
17
17
|
@ui.logger.debug { "Network Teardown: #{self.id} " }
|
|
18
18
|
|
|
19
|
-
self.route and
|
|
19
|
+
self.route and manage_route(:del)
|
|
20
20
|
self.down
|
|
21
21
|
self.destroy
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def
|
|
25
|
-
|
|
26
|
-
command = ZTK::Command.new(:ui => @ui, :silence => true, :ignore_exit_status => true)
|
|
24
|
+
def manage_route(action)
|
|
25
|
+
command = ZTK::Command.new(:ui => @ui, :silence => true, :ignore_exit_status => true)
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
case RUBY_PLATFORM
|
|
28
|
+
when /darwin/ then
|
|
29
|
+
action = ((action == :del) ? :delete : :add)
|
|
30
|
+
command.exec(%(sudo route #{action} -net #{TestLab::Utility.network(self.address)} #{self.node.ip} #{TestLab::Utility.netmask(self.address)}))
|
|
31
|
+
when /linux/ then
|
|
32
|
+
command.exec(%(sudo route #{action} -net #{TestLab::Utility.network(self.address)} netmask #{TestLab::Utility.netmask(self.address)} gw #{self.node.ip}))
|
|
34
33
|
end
|
|
35
34
|
end
|
|
36
35
|
|
|
@@ -38,8 +38,6 @@ class TestLab
|
|
|
38
38
|
|
|
39
39
|
# ensure our vagrant key is there
|
|
40
40
|
@config[:vagrant] ||= Hash.new
|
|
41
|
-
|
|
42
|
-
render_vagrantfile
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
################################################################################
|
|
@@ -174,6 +172,7 @@ class TestLab
|
|
|
174
172
|
command = TestLab.build_command_line("vagrant", *args)
|
|
175
173
|
@ui.logger.debug { "command == #{command.inspect}" }
|
|
176
174
|
|
|
175
|
+
render_vagrantfile
|
|
177
176
|
ZTK::Command.new(:ui => @ui, :silence => true).exec(command)
|
|
178
177
|
end
|
|
179
178
|
|
data/lib/testlab/version.rb
CHANGED
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.4.
|
|
4
|
+
version: 0.4.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-05-
|
|
12
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: gli
|
|
@@ -281,7 +281,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
281
281
|
version: '0'
|
|
282
282
|
segments:
|
|
283
283
|
- 0
|
|
284
|
-
hash:
|
|
284
|
+
hash: 3482118721192015302
|
|
285
285
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
286
286
|
none: false
|
|
287
287
|
requirements:
|
|
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
290
290
|
version: '0'
|
|
291
291
|
segments:
|
|
292
292
|
- 0
|
|
293
|
-
hash:
|
|
293
|
+
hash: 3482118721192015302
|
|
294
294
|
requirements: []
|
|
295
295
|
rubyforge_project:
|
|
296
296
|
rubygems_version: 1.8.25
|