Class: Chef::ChefFS::FileSystem::NodesDir
- Inherits:
-
RestListDir
- Object
- BaseFSObject
- BaseFSDir
- RestListDir
- Chef::ChefFS::FileSystem::NodesDir
- Defined in:
- lib/chef/chef_fs/file_system/nodes_dir.rb
Instance Attribute Summary
Attributes inherited from RestListDir
Attributes inherited from BaseFSObject
Instance Method Summary collapse
-
#children ⇒ Object
Override children to respond to environment.
-
#initialize(parent) ⇒ NodesDir
constructor
A new instance of NodesDir.
Methods inherited from RestListDir
#_make_child_entry, #can_have_child?, #child, #create_child, #environment, #rest
Methods inherited from BaseFSDir
#can_have_child?, #child, #dir?
Methods inherited from BaseFSObject
#can_have_child?, #child, #compare_to, #dir?, #exists?, #path_for_printing, #root
Constructor Details
#initialize(parent) ⇒ NodesDir
Returns a new instance of NodesDir.
27 28 29 |
# File 'lib/chef/chef_fs/file_system/nodes_dir.rb', line 27 def initialize(parent) super("nodes", parent) end |
Instance Method Details
#children ⇒ Object
Override children to respond to environment
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/chef/chef_fs/file_system/nodes_dir.rb', line 32 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 Chef::ChefFS::FileSystem::NotFoundError.new($!), "#{path_for_printing} not found" else raise end end end |