diff options
author | Mickaẽl Canévet <mickael.canevet@camptocamp.com> | 2013-11-24 10:44:37 +0100 |
---|---|---|
committer | Mickaẽl Canévet <mickael.canevet@camptocamp.com> | 2013-11-24 10:44:37 +0100 |
commit | c9c6d96554e546f70a289522df3f24261674cc1c (patch) | |
tree | 548b6e578a7137aeeb5d99e6cfe4e4b829aa8c1b /lib/puppet/provider | |
parent | f2f1a82d72ec8afb50c32206abeaa32923ee410b (diff) | |
download | puppet-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.rb | 2 | ||||
-rw-r--r-- | lib/puppet/provider/vcsrepo/hg.rb | 2 |
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 |