summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2010-04-12 15:10:01 -0700
committerLuke Kanies <luke@puppetlabs.com>2010-04-12 15:10:01 -0700
commit9ee4c2dc06aee189994e3e06910e52bced4c6854 (patch)
tree7d61e276bb69797967a2e787f1997bcb40d5479f /lib
parent8c31ebe7f2da5d5f246d9994b0f84636009e1a70 (diff)
downloadpuppet-9ee4c2dc06aee189994e3e06910e52bced4c6854.tar.gz
puppet-9ee4c2dc06aee189994e3e06910e52bced4c6854.tar.xz
puppet-9ee4c2dc06aee189994e3e06910e52bced4c6854.zip
Only trying to retrieve passwords on OS X when root
We were otherwise failing whenever we tried to read a user. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/provider/nameservice/directoryservice.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb
index 50c87fe3e..9a860b71e 100644
--- a/lib/puppet/provider/nameservice/directoryservice.rb
+++ b/lib/puppet/provider/nameservice/directoryservice.rb
@@ -215,7 +215,7 @@ class DirectoryService < Puppet::Provider::NameService
# stored in the user record. It is stored at a path that involves the
# UUID of the user record for non-Mobile local acccounts.
# Mobile Accounts are out of scope for this provider for now
- if @resource_type.validproperties.include?(:password)
+ if @resource_type.validproperties.include?(:password) and Process.uid == 0
attribute_hash[:password] = self.get_password(attribute_hash[:guid])
end
return attribute_hash
@@ -324,7 +324,7 @@ class DirectoryService < Puppet::Provider::NameService
password_hash_file = "#{@@password_hash_dir}/#{guid}"
if File.exists?(password_hash_file) and File.file?(password_hash_file)
if not File.readable?(password_hash_file)
- fail("Could not read password hash file at #{password_hash_file} for #{@resource[:name]}")
+ fail("Could not read password hash file at #{password_hash_file}")
end
f = File.new(password_hash_file)
password_hash = f.read