From 27c5d5847504d6d5e295b617b1461b4727ccf1f2 Mon Sep 17 00:00:00 2001 From: Paul Chechetin Date: Wed, 20 Aug 2014 11:47:34 +0400 Subject: Change uid by Puppet execution API --- lib/puppet/provider/vcsrepo/git.rb | 4 +--- lib/puppet/provider/vcsrepo/hg.rb | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/puppet') 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 -- cgit v1.2.3