Sha256: 9c45180b39be71c39d972ac6acf8e3fdac47ecc175e7895efff749ecb746e14f

Contents?: true

Size: 590 Bytes

Versions: 2

Compression:

Stored size: 590 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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knife-essentials-0.1.1 lib/chef_fs/file_system/data_bags_dir.rb
knife-essentials-0.1 lib/chef_fs/file_system/data_bags_dir.rb