From 80ec4943a9db1272fb405a459a763f8b8a6abd52 Mon Sep 17 00:00:00 2001 From: luke Date: Mon, 30 Apr 2007 19:42:58 +0000 Subject: Fixing #430 (I hope) -- execs now autorequire the specified user git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2442 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/type/exec.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index ad33c755a..5a045f630 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -156,11 +156,13 @@ module Puppet newparam(:user) do desc "The user to run the command as. Note that if you use this then any error output is not currently captured. This - is because of a bug within Ruby." + is because of a bug within Ruby. If you are using Puppet to + create this user, the exec will automatically require the user, + as long as it is specified by name." # Most validation is handled by the SUIDManager class. validate do |user| - unless Puppet::Util::SUIDManager.uid == 0 + unless Puppet.features.root? self.fail "Only root can execute commands as other users" end end @@ -434,6 +436,13 @@ module Puppet reqs end + autorequire(:user) do + # Autorequire users if they are specified by name + if user = self[:user] and user !~ /^\d+$/ + user + end + end + def self.list self.collect { |i| i } end -- cgit