diff options
author | Paul Chechetin <paulche@yandex.ru> | 2014-08-20 11:47:34 +0400 |
---|---|---|
committer | Paul Chechetin <paulche@yandex.ru> | 2014-08-20 11:55:40 +0400 |
commit | 27c5d5847504d6d5e295b617b1461b4727ccf1f2 (patch) | |
tree | 427cc2b497216813090e65fbb08fb85f916e6f8e /lib/puppet/provider/vcsrepo | |
parent | 177618e2ccdd610890e04502923b39a61f7cb40a (diff) | |
download | puppet-vcsrepo-27c5d5847504d6d5e295b617b1461b4727ccf1f2.tar.gz puppet-vcsrepo-27c5d5847504d6d5e295b617b1461b4727ccf1f2.tar.bz2 |
Change uid by Puppet execution API
Diffstat (limited to 'lib/puppet/provider/vcsrepo')
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 4 | ||||
-rw-r--r-- | lib/puppet/provider/vcsrepo/hg.rb | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 0a142bb..9e0306b 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 @@ -365,7 +363,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 |