diff options
author | Luke Kanies <luke@madstop.com> | 2007-11-23 17:03:22 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-11-23 17:03:22 -0600 |
commit | 56aad69f8cdf8b0b08fdb7985014986223fa4455 (patch) | |
tree | 622d59973f9ea23e049f8afdccd82c1b3f54c0f0 /lib/puppet | |
parent | a670615fb6feef7ea41f3a31bee6a9a8c5dadc03 (diff) | |
download | puppet-56aad69f8cdf8b0b08fdb7985014986223fa4455.tar.gz puppet-56aad69f8cdf8b0b08fdb7985014986223fa4455.tar.xz puppet-56aad69f8cdf8b0b08fdb7985014986223fa4455.zip |
Patching a bit for #804 by making the maximum much higher UID
and making it tunable, but it has not gone away yet.
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/defaults.rb | 6 | ||||
-rwxr-xr-x | lib/puppet/type/pfile/owner.rb | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 616c1519d..9a95c3cab 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -148,7 +148,11 @@ module Puppet :daemonize => { :default => true, :desc => "Send the process into the background. This is the default.", :short => "D" - } + }, + :maximum_uid => [4294967290, "The maximum allowed UID. Some platforms use negative UIDs + but then ship with tools that do not know how to handle signed ints, so the UIDs show up as + huge numbers that can then not be fed back into the system. This is a hackish way to fail in a + slightly more useful way when that happens."] ) hostname = Facter["hostname"].value diff --git a/lib/puppet/type/pfile/owner.rb b/lib/puppet/type/pfile/owner.rb index d3fedd44e..6f9bbd6a2 100755 --- a/lib/puppet/type/pfile/owner.rb +++ b/lib/puppet/type/pfile/owner.rb @@ -6,12 +6,9 @@ module Puppet @event = :file_changed def id2name(id) - if id.is_a?(Symbol) - return id.to_s - end - if id > 70000 - return nil - end + return id.to_s if id.is_a?(Symbol) + return nil if id > Puppet[:maximum_uid].to_i + begin user = Etc.getpwuid(id) rescue TypeError @@ -19,6 +16,7 @@ module Puppet rescue ArgumentError return nil end + if user.uid == "" return nil else @@ -113,8 +111,8 @@ module Puppet # On OS X, files that are owned by -2 get returned as really # large UIDs instead of negative ones. This isn't a Ruby bug, # it's an OS X bug, since it shows up in perl, too. - if currentvalue > 120000 - self.warning "current state is silly: %s" % currentvalue + if currentvalue > Puppet[:maximum_uid].to_i + self.warning "Apparently using negative UID (%s) on a platform that does not consistently handle them" % currentvalue currentvalue = :silly end |