Class: Chef::ChefFS::FileSystem::ChefServer::AclEntry
- Inherits:
-
RestListEntry
- Object
- BaseFSObject
- RestListEntry
- Chef::ChefFS::FileSystem::ChefServer::AclEntry
- Defined in:
- lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
Constant Summary collapse
- PERMISSIONS =
%w{create read update delete grant}
Instance Attribute Summary
Attributes inherited from BaseFSObject
Instance Method Summary collapse
Methods inherited from RestListEntry
#_read_json, #api_child_name, #api_error_text, #chef_object, #compare_to, #data_handler, #environment, #exists?, #initialize, #minimize_value, #org, #read, #rest
Methods inherited from BaseFSObject
#can_have_child?, #chef_object, #child, #children, #compare_to, #create_child, #dir?, #exists?, #initialize, #path_for_printing, #read, #root
Constructor Details
This class inherits a constructor from Chef::ChefFS::FileSystem::ChefServer::RestListEntry
Instance Method Details
#api_path ⇒ Object
31 32 33 |
# File 'lib/chef/chef_fs/file_system/chef_server/acl_entry.rb', line 31 def api_path "#{super}/_acl" end |
#delete(recurse) ⇒ Object
35 36 37 |
# File 'lib/chef/chef_fs/file_system/chef_server/acl_entry.rb', line 35 def delete(recurse) raise Chef::ChefFS::FileSystem::OperationNotAllowedError.new(:delete, self, nil, "ACLs cannot be deleted") end |
#write(file_contents) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/chef/chef_fs/file_system/chef_server/acl_entry.rb', line 39 def write(file_contents) # ACL writes are fun. acls = data_handler.normalize(Chef::JSONCompat.parse(file_contents), self) PERMISSIONS.each do || begin rest.put("#{api_path}/#{}", { => acls[] }) rescue Timeout::Error => e raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, e, "Timeout writing: #{e}") rescue Net::HTTPServerException => e if e.response.code == "404" raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e) else raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, e, "HTTP error writing: #{e}") end end end end |