Skip to content

Commit

Permalink
Fix home dir detection on windows
Browse files Browse the repository at this point in the history
Add windows to the list of supported Operating Systems so that
acceptance tests are also run on this platform.

We need to set a clear-text password for the windows user provider
to avoid an OLE error code:800708C5 in Active Directory (The password
does not meet the password policy requirements).
  • Loading branch information
elfranne authored and smortex committed Apr 11, 2024
1 parent f1d9f4d commit a32a229
Show file tree
Hide file tree
Showing 3 changed files with 14 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
2 changes: 2 additions & 0 deletions spec/acceptance/clone_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
pp = <<-MANIFEST
user { 'vagrant':
ensure => present,
password => if ($facts['os']['family'] == 'windows') { 'CorrectHorseBatteryStaple0!' },
}
MANIFEST

Expand Down Expand Up @@ -369,6 +370,7 @@
user { 'testuser':
ensure => present,
groups => 'testuser',
password => if ($facts['os']['family'] == 'windows') { 'CorrectHorseBatteryStaple0!' },
}
MANIFEST

Expand Down

0 comments on commit a32a229

Please sign in to comment.