diff options
author | Morgan Haskel <morgan@puppetlabs.com> | 2015-08-24 17:07:37 -0700 |
---|---|---|
committer | Morgan Haskel <morgan@puppetlabs.com> | 2015-08-25 16:15:34 -0700 |
commit | ba9d0cf6c1d98ea70270faa5cf4e70997ea75595 (patch) | |
tree | 475978aa099a30b76d56c0209047178dab2a972b | |
parent | d196a2a61deee9290826407ab17b994e0747f0af (diff) |
MODULES-1232 Make sure HOME is set correctly
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 4623f8e..a34b154 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -3,7 +3,9 @@ require File.join(File.dirname(__FILE__), '..', 'vcsrepo') Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) do desc "Supports Git repositories" - commands :git => 'git' + has_command(:git, 'git') do + environment({ 'HOME' => ENV['HOME'] }) + end has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth, :branch, :submodules @@ -457,7 +459,8 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) return ret end elsif @resource.value(:user) and @resource.value(:user) != Facter['id'].value - Puppet::Util::Execution.execute("git #{args.join(' ')}", :uid => @resource.value(:user), :failonfail => true) + env = Etc.getpwnam(@resource.value(:user)) + Puppet::Util::Execution.execute("git #{args.join(' ')}", :uid => @resource.value(:user), :failonfail => true, :custom_environment => {'HOME' => env['dir']}) else git(*args) end |