Skip to content

Commit

Permalink
Merge pull request #553 from puppetlabs/GH-552-home_directory_evaluat…
Browse files Browse the repository at this point in the history
…ion_fix

(GH-552) Fix home directory evaluation
  • Loading branch information
david22swan authored Jun 29, 2022
2 parents c23a38e + 28c8a65 commit 8d0cd41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/puppet/provider/vcsrepo/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,11 @@ def exec_git(*args)
exec_args = {
failonfail: true,
combine: true,
custom_environment: { 'HOME' => Dir.home },
custom_environment: { 'HOME' => Etc.getpwuid(Process.uid).dir },
}

if @resource.value(:user) && @resource.value(:user) != Facter['id'].value
exec_args[:custom_environment] = { 'HOME' => Dir.home(@resource.value(:user)) }
exec_args[:custom_environment] = { 'HOME' => Etc.getpwnam(@resource.value(:user)).dir }
exec_args[:uid] = @resource.value(:user)
end
Puppet::Util::Execution.execute([:git, args], **exec_args)
Expand Down

0 comments on commit 8d0cd41

Please sign in to comment.