Sha256: 619f6e92c9c79fb71bb3fd86d369b561a2be53ec7ed8186dad87f00714b6f80f

Contents?: true

Size: 656 Bytes

Versions: 3

Compression:

Stored size: 656 Bytes

Contents

require 'chef_fs/file_system/rest_list_dir'
require 'chef_fs/file_system/data_bag_dir'

# TODO: take environment into account

module ChefFS
  module FileSystem
    class DataBagsDir < RestListDir
      def initialize(parent)
        super("data_bags", parent, "data")
      end

      def child(name)
        result = @children.select { |child| child.name == name }.first if @children
        result || DataBagDir.new(name, self)
      end

      def children
        @children ||= rest.get_rest(api_path).keys.map { |entry| DataBagDir.new(entry, self, true) }
      end

      def can_have_child?(name, is_dir)
        is_dir
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
knife-essentials-0.3 lib/chef_fs/file_system/data_bags_dir.rb
knife-essentials-0.2.1 lib/chef_fs/file_system/data_bags_dir.rb
knife-essentials-0.2 lib/chef_fs/file_system/data_bags_dir.rb