summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/util.rb')
-rw-r--r--lib/puppet/util.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb
index 1d4515b3d..e842ffd3f 100644
--- a/lib/puppet/util.rb
+++ b/lib/puppet/util.rb
@@ -16,6 +16,13 @@ module Util
olduid = nil
oldgid = nil
+ # If they're running as a normal user, then just execute as that same
+ # user.
+ unless Process.uid == 0
+ yield
+ return
+ end
+
begin
# the groupid, if we got passed a group
# The gid has to be changed first, because, well, otherwise we won't