Skip to content

Commit

Permalink
Fix home dir detection on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
elfranne authored and smortex committed Apr 11, 2024
1 parent f1d9f4d commit 2e03f72
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/provider/vcsrepo/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -734,11 +734,11 @@ def exec_git(*args)
exec_args = {
failonfail: true,
combine: true,
custom_environment: { 'HOME' => Etc.getpwuid(Process.uid).dir }
custom_environment: { 'HOME' => Dir.home },
}

if @resource.value(:user) && @resource.value(:user) != Facter['id'].value
exec_args[:custom_environment] = { 'HOME' => Etc.getpwnam(@resource.value(:user)).dir }
exec_args[:custom_environment] = { 'HOME' => Dir.home(@resource.value(:user)) }
exec_args[:uid] = @resource.value(:user)
end
withumask do
Expand Down
13 changes: 10 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@
"source": "https://github.com/puppetlabs/puppetlabs-vcsrepo",
"project_page": "https://github.com/puppetlabs/puppetlabs-vcsrepo",
"issues_url": "https://github.com/puppetlabs/puppetlabs-vcsrepo/issues",
"dependencies": [

],
"dependencies": [],
"operatingsystem_support": [
{
"operatingsystem": "Windows",
"operatingsystemrelease": [
"10",
"11",
"2019",
"2022"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/clone_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@
pp = <<-MANIFEST
user { 'vagrant':
ensure => present,
groups => 'vagrant',
password => 'CorrectHorseBatteryStaple0!',
}
MANIFEST

Expand Down Expand Up @@ -369,6 +371,7 @@
user { 'testuser':
ensure => present,
groups => 'testuser',
password => 'CorrectHorseBatteryStaple0!',
}
MANIFEST

Expand Down

0 comments on commit 2e03f72

Please sign in to comment.