summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshley Penney <ashley.penney@puppetlabs.com>2014-01-24 05:52:13 -0800
committerAshley Penney <ashley.penney@puppetlabs.com>2014-01-24 05:52:13 -0800
commit50079b58192ed7a2af1ba6756f75084bc74d33e8 (patch)
tree7987d1ffdd223c97da2b10be11511978c711edc0
parent1ac866a034ba37fb1fb4ed8a562d936751b43825 (diff)
parentc9c6d96554e546f70a289522df3f24261674cc1c (diff)
downloadpuppet-vcsrepo-50079b58192ed7a2af1ba6756f75084bc74d33e8.tar.gz
puppet-vcsrepo-50079b58192ed7a2af1ba6756f75084bc74d33e8.tar.bz2
Merge pull request #105 from mcanevet/no_su
Don't 'su' if passed user is current user
-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 cdae459..c96095b 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -318,7 +318,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