From 8572dfd59c21d2032b030adc9dc9a973c6e1c3f5 Mon Sep 17 00:00:00 2001 From: elijah Date: Sat, 8 Dec 2012 20:02:27 -0800 Subject: added commands 'node add' 'node rm' and 'node mv' --- lib/leap_cli/config/object.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lib/leap_cli/config/object.rb') 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 ## -- cgit v1.2.3