class Chef::ChefFS::FileSystem::ChefServer::NodesDir

Public Instance Methods

children() click to toggle source

Identical to Chef::ChefFS::FileSystem::ChefServer::RestListDir#children, except supports environments

# File lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb, line 30
def children
  @children ||= root.get_json(env_api_path).keys.sort.map do |key|
    make_child_entry(key, true)
  end
rescue Timeout::Error => e
  raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "Timeout retrieving children: #{e}")
rescue Net::HTTPServerException => e
  if $!.response.code == "404"
    raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
  else
    raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e, "HTTP error retrieving children: #{e}")
  end
end
env_api_path() click to toggle source
# File lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb, line 44
def env_api_path
  environment ? "environments/#{environment}/#{api_path}" : api_path
end