diff options
Diffstat (limited to 'lib/leap_cli/config')
| -rw-r--r-- | lib/leap_cli/config/manager.rb | 9 | ||||
| -rw-r--r-- | lib/leap_cli/config/node.rb | 15 | ||||
| -rw-r--r-- | lib/leap_cli/config/object.rb | 15 | 
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        #  | 
