aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-03-08 23:08:42 -0800
committerelijah <elijah@riseup.net>2013-03-08 23:08:42 -0800
commit8e9d2ada3bf0599ab160bd070c6fb214224d5228 (patch)
tree9ef15e40d72d0a2c046bb22999e44360d3dfd323
parentebc1724821ea91b488a8289079d5fff605b03e3e (diff)
downloadleap_cli-8e9d2ada3bf0599ab160bd070c6fb214224d5228.tar.gz
leap_cli-8e9d2ada3bf0599ab160bd070c6fb214224d5228.tar.bz2
replace local and production values with 'environment'.
-rw-r--r--lib/leap_cli/commands/vagrant.rb4
-rw-r--r--lib/leap_cli/config/object.rb8
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/leap_cli/commands/vagrant.rb b/lib/leap_cli/commands/vagrant.rb
index 3526d23..f7505f2 100644
--- a/lib/leap_cli/commands/vagrant.rb
+++ b/lib/leap_cli/commands/vagrant.rb
@@ -85,7 +85,7 @@ module LeapCli; module Commands
if args.empty?
nodes = [""]
else
- nodes = manager.filter(args)[:local => true].field(:name)
+ nodes = manager.filter(args)[:environment => "local"].field(:name)
end
if nodes.any?
vagrant_dir = File.dirname(Path.named_path(:vagrantfile))
@@ -138,7 +138,7 @@ module LeapCli; module Commands
end
def pick_next_vagrant_ip_address
- taken_ips = manager.nodes[:local => true].field(:ip_address)
+ taken_ips = manager.nodes[:environment => "local"].field(:ip_address)
if taken_ips.any?
highest_ip = taken_ips.map{|ip| IPAddr.new(ip)}.max
new_ip = highest_ip.succ
diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb
index e4fe619..4f5afe1 100644
--- a/lib/leap_cli/config/object.rb
+++ b/lib/leap_cli/config/object.rb
@@ -124,8 +124,8 @@ module LeapCli
# merge hashes
if old_value.is_a?(Hash) || new_value.is_a?(Hash)
value = Config::Object.new(@manager, @node)
- old_value.is_a?(Hash) ? value.deep_merge!(old_value) : (value[key] = old_value if old_value.any?)
- new_value.is_a?(Hash) ? value.deep_merge!(new_value, prefer_self) : (value[key] = new_value if new_value.any?)
+ old_value.is_a?(Hash) ? value.deep_merge!(old_value) : (value[key] = old_value if !old_value.nil?)
+ new_value.is_a?(Hash) ? value.deep_merge!(new_value, prefer_self) : (value[key] = new_value if !new_value.nil?)
# merge arrays
elsif old_value.is_a?(Array) || new_value.is_a?(Array)
@@ -184,10 +184,10 @@ module LeapCli
end
#
- # returns a list of nodes that match similar production level (production, local, development, etc)
+ # returns a list of nodes that match the same environment
#
def nodes_like_me
- nodes[:production => @node.production, :local => @node.local, :development => @node.development]
+ nodes[:environment => @node.environment]
end
class FileMissing < Exception