testlab 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
data/bin/tl CHANGED
@@ -198,6 +198,26 @@ command :network do |c|
198
198
  @testlab.ui.stdout.puts %x(netstat -nr | grep '#{network.node.ip}').strip
199
199
  end
200
200
  end
201
+
202
+ # ROUTE SHOW
203
+ #############
204
+ route.desc 'Show routes to lab networks'
205
+ route.command :show do |show|
206
+ show.action do |global_options,options,args|
207
+ help_now!('id is required') if options[:id].nil?
208
+
209
+ network = @testlab.networks.select{ |c| c.id.to_sym == options[:id].to_sym }.first
210
+ network.nil? and raise TestLab::TestLabError, "We could not find the network you supplied!"
211
+
212
+ @testlab.ui.stdout.puts("TestLab routes:".green.bold)
213
+ case RUBY_PLATFORM
214
+ when /darwin/ then
215
+ @testlab.ui.stdout.puts %x(netstat -nrf inet | grep '#{network.node.ip}').strip
216
+ when /linux/ then
217
+ @testlab.ui.stdout.puts %x(netstat -nr | grep '#{network.node.ip}').strip
218
+ end
219
+ end
220
+ end
201
221
  end
202
222
 
203
223
  # NETWORK STATUS
@@ -9,14 +9,14 @@ class TestLab
9
9
  class Interface < ZTK::DSL::Base
10
10
 
11
11
  # Associations and Attributes
12
- belongs_to :container, :class_name => 'TestLab::Container'
13
- belongs_to :network, :class_name => 'TestLab::Network'
12
+ belongs_to :container, :class_name => 'TestLab::Container'
13
+ belongs_to :network, :class_name => 'TestLab::Network'
14
14
 
15
15
  attribute :address
16
16
  attribute :mac
17
17
  attribute :name
18
18
 
19
- attribute :primary, :default => false
19
+ attribute :primary, :default => false
20
20
 
21
21
  def initialize(*args)
22
22
  super(*args)
@@ -7,9 +7,9 @@ class TestLab
7
7
  #
8
8
  # @author Zachary Patten <zachary AT jovelabs DOT com>
9
9
  class Labfile < ZTK::DSL::Base
10
- has_many :nodes, :class_name => 'TestLab::Node'
10
+ has_many :nodes, :class_name => 'TestLab::Node'
11
11
 
12
- attribute :config, :default => Hash.new
12
+ attribute :config, :default => Hash.new
13
13
  end
14
14
 
15
15
  end
data/lib/testlab/node.rb CHANGED
@@ -34,14 +34,14 @@ class TestLab
34
34
  include TestLab::Utility::Misc
35
35
 
36
36
  # Associations and Attributes
37
- belongs_to :labfile, :class_name => 'TestLab::Labfile'
37
+ belongs_to :labfile, :class_name => 'TestLab::Labfile'
38
38
 
39
- has_many :containers, :class_name => 'TestLab::Container'
40
- has_many :networks, :class_name => 'TestLab::Network'
39
+ has_many :containers, :class_name => 'TestLab::Container'
40
+ has_many :networks, :class_name => 'TestLab::Network'
41
41
 
42
42
  attribute :provider
43
- attribute :config, :default => Hash.new
44
- attribute :components, :default => Array.new
43
+ attribute :config, :default => Hash.new
44
+ attribute :components, :default => Array.new
45
45
 
46
46
 
47
47
  def initialize(*args)
@@ -1,6 +1,6 @@
1
1
  class TestLab
2
2
  unless const_defined?(:VERSION)
3
3
  # TestLab Gem Version
4
- VERSION = "0.4.6"
4
+ VERSION = "0.4.7"
5
5
  end
6
6
  end
data/lib/testlab.rb CHANGED
@@ -222,7 +222,7 @@ class TestLab
222
222
  def method_missing(method_name, *method_args)
223
223
  self.ui.logger.debug { "TESTLAB METHOD MISSING: #{method_name.inspect}(#{method_args.inspect})" }
224
224
 
225
- if TestLab::Provider::PROXY_METHODS.include?(method_name) # || %w(setup teardown).map(&:to_sym).include?(method_name))
225
+ if TestLab::Provider::PROXY_METHODS.include?(method_name)
226
226
  node_method_proxy(method_name, *method_args)
227
227
  else
228
228
  super(method_name, *method_args)
@@ -235,7 +235,7 @@ class TestLab
235
235
  # class.
236
236
  module DualMethods
237
237
 
238
- @@ui ||= nil
238
+ @@ui = nil
239
239
 
240
240
  # Get Test Lab User Interface
241
241
  #
@@ -284,7 +284,7 @@ class TestLab
284
284
 
285
285
  end
286
286
 
287
- include TestLab::DualMethods
288
287
  extend TestLab::DualMethods
288
+ include TestLab::DualMethods
289
289
 
290
290
  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.4.6
4
+ version: 0.4.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: