class Chef::ChefFS::FileSystem::NodesDir
Public Class Methods
new(parent)
click to toggle source
Calls superclass method
# File lib/chef/chef_fs/file_system/nodes_dir.rb, line 28 def initialize(parent) super("nodes", parent, nil, Chef::ChefFS::DataHandler::NodeDataHandler.new) end
Public Instance Methods
children()
click to toggle source
Identical to Chef::ChefFS::FileSystem::RestListDir#children, except supports environments
# File lib/chef/chef_fs/file_system/nodes_dir.rb, line 33 def children begin @children ||= root.get_json(env_api_path).keys.sort.map do |key| _make_child_entry("#{key}.json", 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 end
env_api_path()
click to toggle source
# File lib/chef/chef_fs/file_system/nodes_dir.rb, line 49 def env_api_path environment ? "environments/#{environment}/#{api_path}" : api_path end