Don't 'su' if passed user is current user
authorMickaẽl Canévet <mickael.canevet@camptocamp.com>
Sun, 24 Nov 2013 09:44:37 +0000 (10:44 +0100)
committerMickaẽl Canévet <mickael.canevet@camptocamp.com>
Sun, 24 Nov 2013 09:44:37 +0000 (10:44 +0100)
lib/puppet/provider/vcsrepo/git.rb
lib/puppet/provider/vcsrepo/hg.rb

index 47e84d2..442ea61 100644 (file)
@@ -314,7 +314,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
 
         return ret
       end
-    elsif @resource.value(:user)
+    elsif @resource.value(:user) and @resource.value(:user) != Facter['id'].value
       su(@resource.value(:user), '-c', "git #{args.join(' ')}" )
     else
       git(*args)
index 4886b7a..33f1e6a 100644 (file)
@@ -105,7 +105,7 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
     if @resource.value(:identity)
       args += ["--ssh", "ssh -oStrictHostKeyChecking=no -oPasswordAuthentication=no -oKbdInteractiveAuthentication=no -oChallengeResponseAuthentication=no -i #{@resource.value(:identity)}"]
     end
-    if @resource.value(:user)
+    if @resource.value(:user) and @resource.value(:user) != Facter['id'].value
       args.map! { |a| if a =~ /\s/ then "'#{a}'" else a end }  # Adds quotes to arguments with whitespaces.
       su(@resource.value(:user), '-c', "hg #{args.join(' ')}")
     else