summaryrefslogtreecommitdiff
path: root/lib/puppet/provider
diff options
context:
space:
mode:
authorMickaẽl Canévet <mickael.canevet@camptocamp.com>2013-11-24 10:44:37 +0100
committerMickaẽl Canévet <mickael.canevet@camptocamp.com>2013-11-24 10:44:37 +0100
commitc9c6d96554e546f70a289522df3f24261674cc1c (patch)
tree548b6e578a7137aeeb5d99e6cfe4e4b829aa8c1b /lib/puppet/provider
parentf2f1a82d72ec8afb50c32206abeaa32923ee410b (diff)
downloadpuppet-vcsrepo-c9c6d96554e546f70a289522df3f24261674cc1c.tar.gz
puppet-vcsrepo-c9c6d96554e546f70a289522df3f24261674cc1c.tar.bz2
Don't 'su' if passed user is current user
Diffstat (limited to 'lib/puppet/provider')
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb2
-rw-r--r--lib/puppet/provider/vcsrepo/hg.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 47e84d2..442ea61 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -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)
diff --git a/lib/puppet/provider/vcsrepo/hg.rb b/lib/puppet/provider/vcsrepo/hg.rb
index 4886b7a..33f1e6a 100644
--- a/lib/puppet/provider/vcsrepo/hg.rb
+++ b/lib/puppet/provider/vcsrepo/hg.rb
@@ -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