I'd much prefer the groups= method have this behaviour in it, rather than have it done at loading time.

Everyone loads this util module but not everyone uses the groups= method, so just having the code in groups= will make testing/debugging much easier and just generally make the system simpler.

On Mar 26, 2010, at 4:04 PM, Nigel Kersten wrote:


Signed-off-by: Nigel Kersten <[email protected]>
---
lib/puppet/util/suidmanager.rb |   15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/ suidmanager.rb
index a0a9178..99ed3a4 100644
--- a/lib/puppet/util/suidmanager.rb
+++ b/lib/puppet/util/suidmanager.rb
@@ -9,12 +9,25 @@ module Puppet::Util::SUIDManager
    to_delegate_to_process = [ :euid=, :euid, :egid=, :egid,
:uid =, :uid, :gid=, :gid, :groups=, :groups ]

+    if Facter.value('kernel') == 'Darwin'
+        Facter.loadfacts
+        osx_maj_ver = Facter.value('macosx_productversion_major')
+ raise Puppet::Error, "OS X requires Facter >= 1.5.5" if osx_maj_ver.nil?
+        # Process.groups= broken on 10.6 http://openradar.appspot.com/7791698
+        if osx_maj_ver == '10.6'
+            to_delegate_to_process.delete(:groups=)
+            def self.groups=(grouplist)
+                return true
+            end
+        end
+    end
+
    to_delegate_to_process.each do |method|
        def_delegator Process, method
        module_function method
    end

-    if Facter['kernel'].value == 'Darwin'
+    if Facter.value('kernel') == 'Darwin' and osx_maj_ver == '10.4'
        # Cannot change real UID on Darwin so we set euid
        alias :uid :euid
        alias :gid :egid
--
1.7.0.3

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected] . For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en .



--
I take my children everywhere, but they always find their way
back home. --Robert Orben
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to