Class: ChefFS::FileSystem::AclEntry
- Inherits:
-
RestListEntry
- Object
- BaseFSObject
- RestListEntry
- ChefFS::FileSystem::AclEntry
- Defined in:
- lib/chef_fs/file_system/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_hash, #api_child_name, #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 ChefFS::FileSystem::RestListEntry
Instance Method Details
#api_path ⇒ Object
29 30 31 |
# File 'lib/chef_fs/file_system/acl_entry.rb', line 29 def api_path "#{super}/_acl" end |
#delete(recurse) ⇒ Object
33 34 35 |
# File 'lib/chef_fs/file_system/acl_entry.rb', line 33 def delete(recurse) raise ChefFS::FileSystem::OperationNotAllowedError.new(:delete, self, e), "ACLs cannot be deleted." end |
#write(file_contents) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/chef_fs/file_system/acl_entry.rb', line 37 def write(file_contents) # ACL writes are fun. acls = data_handler.normalize(JSON.parse(file_contents, :create_additions => false), self) PERMISSIONS.each do || begin rest.put_rest("#{api_path}/#{}", { => acls[] }) rescue Timeout::Error => e raise ChefFS::FileSystem::OperationFailedError.new(:write, self, e), "Timeout writing: #{e}" rescue Net::HTTPServerException => e if e.response.code == "404" raise ChefFS::FileSystem::NotFoundError.new(self, e) else raise ChefFS::FileSystem::OperationFailedError.new(:write, self, e), "HTTP error writing: #{e}" end end end end |