From: Dan Bode Date: Thu, 8 Jan 2015 17:06:10 +0000 (+0100) Subject: Lookup username from uuid X-Git-Tag: 1.4.0~11^2~1 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=86620cff165fbffe623e0c8c7bde1204ee76bf30;p=puppet-modules%2Fpuppetlabs-firewall.git Lookup username from uuid When using the uid feature of the firewall module, it did not work with string based usernames as documented. The uid propery always synchronized with a message of does not match . This code overrides the uid getter method to perform a check of both the data from the property hash as well as using that data (assuming it is a uid) to resolve the username. While this patch is pretty simple, I have only tested it on Ubuntu 14.04. I am not sure if it could be problematic with other versions. I have not yet written tests b/c I wanted to submit my proposed fix for discussion while I get those written. --- diff --git a/lib/puppet/type/firewall.rb b/lib/puppet/type/firewall.rb index e7cb04b..88d1aaf 100644 --- a/lib/puppet/type/firewall.rb +++ b/lib/puppet/type/firewall.rb @@ -730,6 +730,11 @@ Puppet::Type.newtype(:firewall) do only, as iptables does not accept multiple uid in a single statement. EOS + def insync?(is) + require 'etc' + return is.to_s == @should.first.to_s || Etc.getpwuid(Integer(is)).name == @should.first.to_s + end + end newproperty(:gid, :required_features => :owner) do