Puppet: System Administration Automated

Support

Ticket #1169: 0001-Extend-workaround-from-56aad69f8cdf8b0b08fdb79850149.patch

File 0001-Extend-workaround-from-56aad69f8cdf8b0b08fdb79850149.patch, 2.7 kB (added by arogge, 8 months ago)

Patch

  • a/lib/puppet/type/file/group.rb

    old new  
    1111        end 
    1212 
    1313        def id2name(id) 
    14             if id > 70000 
    15                 return nil 
    16             end 
    17             if id.is_a?(Symbol) 
    18                 return id.to_s 
    19             end 
     14            return id.to_s if id.is_a?(Symbol) 
     15            return nil if id > Puppet[:maximum_uid].to_i 
    2016            begin 
    2117                group = Etc.getgrgid(id) 
    2218            rescue ArgumentError 
     
    7369                @method = :chown 
    7470            end 
    7571 
    76             return stat.gid 
     72            currentvalue = stat.gid 
     73 
     74            # On OS X, files that are owned by -2 get returned as really 
     75            # large GIDs instead of negative ones.  This isn't a Ruby bug, 
     76            # it's an OS X bug, since it shows up in perl, too. 
     77            if currentvalue > Puppet[:maximum_uid].to_i 
     78                self.warning "Apparently using negative GID (%s) on a platform that does not consistently handle them" % currentvalue 
     79                currentvalue = :silly 
     80            end 
     81 
     82            return currentvalue 
    7783        end 
    7884 
    7985        # Determine if the group is valid, and if so, return the GID 
  • a/lib/puppet/util/posix.rb

    old new  
    1313        end 
    1414        prefix = "get" + space.to_s 
    1515        if id.is_a?(Integer) 
    16             if id > 1000000 
     16            if id > Puppet[:maximum_uid].to_i 
    1717                Puppet.err "Tried to get %s field for silly id %s" % [field, id] 
    1818                return nil 
    1919            end 
     
    4040        end 
    4141        if id.is_a?(Integer) 
    4242            integer = true 
    43             if id > 1000000 
     43            if id > Puppet[:maximum_uid].to_i 
    4444                Puppet.err "Tried to get %s field for silly id %s" % [field, id] 
    4545                return nil 
    4646            end