class Chef::ChefFS::FileSystem::Repository::NodesDir

Public Instance Methods

create_child(child_name, file_contents = nil) click to toggle source
# File lib/chef/chef_fs/file_system/repository/nodes_dir.rb, line 35
def create_child(child_name, file_contents = nil)
  child = super
  File.chmod(0600, child.file_path)
  if ChefUtils.windows?
    read_mask = Chef::ReservedNames::Win32::API::Security::GENERIC_READ
    write_mask = Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE
    administrators = Chef::ReservedNames::Win32::Security::SID.Administrators
    owner = Chef::ReservedNames::Win32::Security::SID.default_security_object_owner
    dacl = Chef::ReservedNames::Win32::Security::ACL.create([
      Chef::ReservedNames::Win32::Security::ACE.access_allowed(owner, read_mask),
      Chef::ReservedNames::Win32::Security::ACE.access_allowed(owner, write_mask),
      Chef::ReservedNames::Win32::Security::ACE.access_allowed(administrators, read_mask),
      Chef::ReservedNames::Win32::Security::ACE.access_allowed(administrators, write_mask),
    ])
    so = Chef::ReservedNames::Win32::Security::SecurableObject.new(child.file_path)
    so.owner = owner
    so.set_dacl(dacl, false)
  end
  child
end
make_child_entry(child_name) click to toggle source
# File lib/chef/chef_fs/file_system/repository/nodes_dir.rb, line 31
def make_child_entry(child_name)
  Node.new(child_name, self)
end