lib/puppet/provider/macauthdb/default.rb
def security_create_right(data)
    plist        = CFPropertyList::List.new
    plist.value  = CFPropertyList.guess(data)
    tmp          = Tempfile.new('puppet_macauthdb')
    begin
      plist.save(tmp.path, CFPropertyList::List::FORMAT_XML)
      tmp.close
      cmds = [:security, "authorizationdb", "write", resource[:name]]
      execute(cmds, :failonfail => false, :combine => false,
        :stdinfile => tmp.path.to_s)
    rescue Errno::EACCES => e
      raise Puppet::Error.new("Cannot save right to #{tmp.path}: #{e}")
    ensure
      tmp.unlink
    end
  end
# Use `security` to create or modify the right or rule
Use `security` to create or modify the right or rule
Use ` security ` to create or modify the right or rule
def security_create_right(data)
    plist        = CFPropertyList::List.new
    plist.value  = CFPropertyList.guess(data)
    tmp          = Tempfile.new('puppet_macauthdb')
    begin
      plist.save(tmp.path, CFPropertyList::List::FORMAT_XML)
      tmp.close
      cmds = [:security, "authorizationdb", "write", resource[:name]]
      execute(cmds, :failonfail => false, :combine => false,
        :stdinfile => tmp.path.to_s)
    rescue Errno::EACCES => e
      raise Puppet::Error.new("Cannot save right to #{tmp.path}: #{e}")
    ensure
      tmp.unlink
    end
  end
def security_create_right ( data ) plist = CFPropertyList :: List . new plist . value = CFPropertyList . guess ( data ) tmp = Tempfile . new ( 'puppet_macauthdb' ) begin plist . save ( tmp . path , CFPropertyList :: List :: FORMAT_XML ) tmp . close cmds = [ :security , "authorizationdb" , "write" , resource [ :name ] ] execute ( cmds , :failonfail => false , :combine => false , :stdinfile => tmp . path . to_s ) rescue Errno :: EACCES => e raise Puppet :: Error . new ( "Cannot save right to #{tmp.path}: #{e}" ) ensure tmp . unlink end end
Use `security` to create or modify the right or rule
Use ` security ` to create or modify the right or rule
data