summaryrefslogtreecommitdiff
path: root/lib/leap_cli/config/object.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-12-08 20:02:27 -0800
committerelijah <elijah@riseup.net>2012-12-08 20:02:27 -0800
commit8572dfd59c21d2032b030adc9dc9a973c6e1c3f5 (patch)
tree3d3fb221339ddf4fa0037cbd88133431307f2e4e /lib/leap_cli/config/object.rb
parent155d744f6c6f94709925f0674f510b3064b6608e (diff)
added commands 'node add' 'node rm' and 'node mv'
Diffstat (limited to 'lib/leap_cli/config/object.rb')
-rw-r--r--lib/leap_cli/config/object.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb
index bbaa6f4..155b51f 100644
--- a/lib/leap_cli/config/object.rb
+++ b/lib/leap_cli/config/object.rb
@@ -199,9 +199,18 @@ module LeapCli
# returns true if this node has an ip address in the range of the vagrant network
#
def vagrant?
- vagrant_range = IPAddr.new @manager.provider.vagrant.network
- ip_address = IPAddr.new @node.ip_address
- vagrant_range.include?(ip_address)
+ begin
+ vagrant_range = IPAddr.new @manager.provider.vagrant.network
+ rescue ArgumentError => exc
+ Util::bail! { Util::log :invalid, "ip address '#{@node.ip_address}' vagrant.network" }
+ end
+
+ begin
+ ip_address = IPAddr.new @node.get('ip_address')
+ rescue ArgumentError => exc
+ Util::log :warning, "invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'"
+ end
+ return vagrant_range.include?(ip_address)
end
##