summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Stone <aaron@serendipity.cx>2014-10-21 12:23:23 -0700
committerAaron Stone <aaron@serendipity.cx>2014-10-21 12:23:23 -0700
commitf6f870b959d1c897cbe23778e54087550e110d14 (patch)
treebf22e7b76ff6a5f5775fa2a23a563b007dceca91
parent6cef9491e5cfdab75d97597592e345a777020376 (diff)
parent27c5d5847504d6d5e295b617b1461b4727ccf1f2 (diff)
downloadpuppet-vcsrepo-f6f870b959d1c897cbe23778e54087550e110d14.tar.gz
puppet-vcsrepo-f6f870b959d1c897cbe23778e54087550e110d14.tar.bz2
Merge pull request #200 from Paulche/change_uid
Change uid by Puppet execution API
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb4
-rw-r--r--lib/puppet/provider/vcsrepo/hg.rb3
2 files changed, 2 insertions, 5 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 48bbe7d..1c6588c 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -3,9 +3,7 @@ require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) do
desc "Supports Git repositories"
- ##TODO modify the commands below so that the su - is included
commands :git => 'git'
- optional_commands :su => 'su'
has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth
@@ -374,7 +372,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
return ret
end
elsif @resource.value(:user) and @resource.value(:user) != Facter['id'].value
- su(@resource.value(:user), '-c', "git #{args.join(' ')}" )
+ Puppet::Util::Execution.execute("git #{args.join(' ')}", :uid => @resource.value(:user), :failonfail => true)
else
git(*args)
end
diff --git a/lib/puppet/provider/vcsrepo/hg.rb b/lib/puppet/provider/vcsrepo/hg.rb
index 090f019..294c2a9 100644
--- a/lib/puppet/provider/vcsrepo/hg.rb
+++ b/lib/puppet/provider/vcsrepo/hg.rb
@@ -4,7 +4,6 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
desc "Supports Mercurial repositories"
commands :hg => 'hg'
- optional_commands :su => 'su'
has_features :reference_tracking, :ssh_identity, :user, :basic_auth
@@ -123,7 +122,7 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
end
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(' ')}")
+ Puppet::Util::Execution.execute("hg #{args.join(' ')}", :uid => @resource.value(:user), :failonfail => true)
else
hg(*args)
end