summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-20 19:41:38 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-20 19:41:38 +0000
commit299bdc1b23bbf39e436f5e67b598d60606ca6513 (patch)
tree26f5d2ae6807a6e2fae1f4aa8f58f56883042333 /lib/puppet
parente605c4aadd3a3c4cccbd01661c21a715ec3f0773 (diff)
downloadpuppet-299bdc1b23bbf39e436f5e67b598d60606ca6513.tar.gz
puppet-299bdc1b23bbf39e436f5e67b598d60606ca6513.tar.xz
puppet-299bdc1b23bbf39e436f5e67b598d60606ca6513.zip
Fixing #380. The problem was that a method was sometimes returning :absent when I expected it to return nil when the group was not found. All fixed, yay.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1960 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/type/pfile/group.rb7
-rwxr-xr-xlib/puppet/type/pfile/uid.rb3
-rwxr-xr-xlib/puppet/util/posix.rb7
3 files changed, 15 insertions, 2 deletions
diff --git a/lib/puppet/type/pfile/group.rb b/lib/puppet/type/pfile/group.rb
index 27ca5c2ff..81059db91 100755
--- a/lib/puppet/type/pfile/group.rb
+++ b/lib/puppet/type/pfile/group.rb
@@ -7,6 +7,12 @@ module Puppet
@event = :file_changed
def id2name(id)
+ if id > 70000
+ return nil
+ end
+ if id.is_a?(Symbol)
+ return id.to_s
+ end
begin
group = Etc.getgrgid(id)
rescue ArgumentError
@@ -63,7 +69,6 @@ module Puppet
if gid = Puppet::Util.gid(value)
return gid
else
- warning "could not find %s" % value
return false
end
end
diff --git a/lib/puppet/type/pfile/uid.rb b/lib/puppet/type/pfile/uid.rb
index 72d2a7e03..891bd56fd 100755
--- a/lib/puppet/type/pfile/uid.rb
+++ b/lib/puppet/type/pfile/uid.rb
@@ -9,6 +9,9 @@ module Puppet
if id.is_a?(Symbol)
return id.to_s
end
+ if id > 70000
+ return nil
+ end
begin
user = Etc.getpwuid(id)
rescue TypeError
diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb
index 01c3e25aa..37ec298bb 100755
--- a/lib/puppet/util/posix.rb
+++ b/lib/puppet/util/posix.rb
@@ -43,7 +43,12 @@ module Puppet::Util::POSIX
if obj.provider
begin
- return obj.provider.send(field)
+ val = obj.provider.send(field)
+ if val == :absent
+ return nil
+ else
+ return val
+ end
rescue => detail
if Puppet[:trace]
puts detail.backtrace