Sha256: 91b7da37fc851f1461fb37fb8831deeada46342f2d21674bff9589d9f85c4be7

Contents?: true

Size: 824 Bytes

Versions: 16

Compression:

Stored size: 824 Bytes

Contents

require 'chef_fs/file_system/base_fs_dir'
require 'chef_fs/file_system/rest_list_entry'
require 'chef_fs/file_system/not_found_error'

module ChefFS
  module FileSystem
    class NodesDir < RestListDir
      def initialize(parent)
        super("nodes", parent)
      end

      # Override children to respond to environment
      def children
        @children ||= begin
          env_api_path = environment ? "environments/#{environment}/#{api_path}" : api_path
          rest.get_rest(env_api_path).keys.map { |key| RestListEntry.new("#{key}.json", self, true) }
        rescue Net::HTTPServerException
          if $!.response.code == "404"
            raise ChefFS::FileSystem::NotFoundError.new($!), "#{path_for_printing} not found"
          else
            raise
          end
        end
    end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
knife-essentials-0.7.6 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.7.5 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.7.4 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.7.3 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.7.2 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.7.1 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.7 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.6.1 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.6 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.5.4 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.5.3 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.5.2 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.5.1 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.5 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.4 lib/chef_fs/file_system/nodes_dir.rb
knife-essentials-0.3.1 lib/chef_fs/file_system/nodes_dir.rb