aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/config
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-06-22 15:52:48 -0700
committerelijah <elijah@riseup.net>2013-06-22 15:52:48 -0700
commit0ffdf42cf2171deb0bdd4c54f8281c1c1257ee86 (patch)
treeb2a6ebe57fbca426104ae364a3a5381e731c4361 /lib/leap_cli/config
parentcae55de7bf25d60f4f504c658b936bbbd94ff464 (diff)
downloadleap_cli-0ffdf42cf2171deb0bdd4c54f8281c1c1257ee86.tar.gz
leap_cli-0ffdf42cf2171deb0bdd4c54f8281c1c1257ee86.tar.bz2
improve `leap inspect`
Diffstat (limited to 'lib/leap_cli/config')
-rw-r--r--lib/leap_cli/config/manager.rb9
-rw-r--r--lib/leap_cli/config/node.rb15
-rw-r--r--lib/leap_cli/config/object.rb15
3 files changed, 20 insertions, 19 deletions
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb
index 8ab8e2f..29721e7 100644
--- a/lib/leap_cli/config/manager.rb
+++ b/lib/leap_cli/config/manager.rb
@@ -17,6 +17,7 @@ module LeapCli
##
attr_reader :services, :tags, :nodes, :provider, :common, :secrets
+ attr_reader :base_services, :base_tags, :base_provider, :base_common
def facts
@facts ||= JSON.parse(Util.read_file(:facts) || "{}")
@@ -33,10 +34,10 @@ module LeapCli
@provider_dir = Path.provider
# load base
- base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base), Config::Tag)
- base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base), Config::Tag)
- base_common = load_json(Path.named_path(:common_config, Path.provider_base), Config::Object)
- base_provider = load_json(Path.named_path(:provider_config, Path.provider_base), Config::Object)
+ @base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base), Config::Tag)
+ @base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base), Config::Tag)
+ @base_common = load_json(Path.named_path(:common_config, Path.provider_base), Config::Object)
+ @base_provider = load_json(Path.named_path(:provider_config, Path.provider_base), Config::Object)
# load provider
provider_path = Path.named_path(:provider_config, @provider_dir)
diff --git a/lib/leap_cli/config/node.rb b/lib/leap_cli/config/node.rb
index 15a2d3d..5b911bf 100644
--- a/lib/leap_cli/config/node.rb
+++ b/lib/leap_cli/config/node.rb
@@ -16,21 +16,6 @@ module LeapCli; module Config
end
#
- # Make a copy of ourselves, except only including the specified keys.
- #
- # Also, the result is flattened to a single hash, so a key of 'a.b' becomes 'a_b'
- #
- def pick(*keys)
- keys.map(&:to_s).inject(self.class.new(@manager)) do |hsh, key|
- value = self.get(key)
- if !value.nil?
- hsh[key.gsub('.','_')] = value
- end
- hsh
- end
- end
-
- #
# returns true if this node has an ip address in the range of the vagrant network
#
def vagrant?
diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb
index 1edef3f..00997b1 100644
--- a/lib/leap_cli/config/object.rb
+++ b/lib/leap_cli/config/object.rb
@@ -184,6 +184,21 @@ module LeapCli
self.deep_merge!(object, true)
end
+ #
+ # Make a copy of ourselves, except only including the specified keys.
+ #
+ # Also, the result is flattened to a single hash, so a key of 'a.b' becomes 'a_b'
+ #
+ def pick(*keys)
+ keys.map(&:to_s).inject(self.class.new(@manager)) do |hsh, key|
+ value = self.get(key)
+ if !value.nil?
+ hsh[key.gsub('.','_')] = value
+ end
+ hsh
+ end
+ end
+
protected
#