From 8214c485816bc852ee33636494b4fd447629961f Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 29 Sep 2006 19:01:05 +0000 Subject: Fixing suidmanager so it uses warnonce instead of using a variable that only existed in Util git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1705 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/suidmanager.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'lib/puppet/suidmanager.rb') diff --git a/lib/puppet/suidmanager.rb b/lib/puppet/suidmanager.rb index 4d00f59b0..d6bbc90f1 100644 --- a/lib/puppet/suidmanager.rb +++ b/lib/puppet/suidmanager.rb @@ -1,7 +1,10 @@ require 'facter' +require 'puppet/util/warnings' module Puppet module SUIDManager + include Puppet::Util::Warnings + platform = Facter["kernel"].value [:uid=, :gid=, :uid, :gid].each do |method| define_method(method) do |*args| @@ -9,10 +12,7 @@ module Puppet newmethod = method if platform == "Darwin" - if !@darwinwarned - Puppet.warning "Cannot change real UID on Darwin" - @darwinwarned = true - end + warnonce "Cannot change real UID on Darwin" newmethod = ("e" + method.to_s).intern end @@ -36,10 +36,7 @@ module Puppet # NOTE: this would be much better facilitated with a specialized popen() # (see the test suite for more details.) if (Facter['rubyversion'].value <=> "1.8.4") < 0 - unless @@alreadywarned - Puppet.warning "Cannot capture STDERR when running as another user on Ruby < 1.8.4" - @@alreadywarned = true - end + warnonce "Cannot capture STDERR when running as another user on Ruby < 1.8.4" output = %x{#{command}} else output = %x{#{command} 2>&1} -- cgit