Skip to content

Commit a32a229

Browse files
elfrannesmortex
authored andcommitted
Fix home dir detection on windows
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).
1 parent f1d9f4d commit a32a229

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

lib/puppet/provider/vcsrepo/git.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -734,11 +734,11 @@ def exec_git(*args)
734734
exec_args = {
735735
failonfail: true,
736736
combine: true,
737-
custom_environment: { 'HOME' => Etc.getpwuid(Process.uid).dir }
737+
custom_environment: { 'HOME' => Dir.home },
738738
}
739739

740740
if @resource.value(:user) && @resource.value(:user) != Facter['id'].value
741-
exec_args[:custom_environment] = { 'HOME' => Etc.getpwnam(@resource.value(:user)).dir }
741+
exec_args[:custom_environment] = { 'HOME' => Dir.home(@resource.value(:user)) }
742742
exec_args[:uid] = @resource.value(:user)
743743
end
744744
withumask do

metadata.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@
77
"source": "https://github.com/puppetlabs/puppetlabs-vcsrepo",
88
"project_page": "https://github.com/puppetlabs/puppetlabs-vcsrepo",
99
"issues_url": "https://github.com/puppetlabs/puppetlabs-vcsrepo/issues",
10-
"dependencies": [
11-
12-
],
10+
"dependencies": [],
1311
"operatingsystem_support": [
12+
{
13+
"operatingsystem": "Windows",
14+
"operatingsystemrelease": [
15+
"10",
16+
"11",
17+
"2019",
18+
"2022"
19+
]
20+
},
1421
{
1522
"operatingsystem": "RedHat",
1623
"operatingsystemrelease": [

spec/acceptance/clone_repo_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
pp = <<-MANIFEST
217217
user { 'vagrant':
218218
ensure => present,
219+
password => if ($facts['os']['family'] == 'windows') { 'CorrectHorseBatteryStaple0!' },
219220
}
220221
MANIFEST
221222

@@ -369,6 +370,7 @@
369370
user { 'testuser':
370371
ensure => present,
371372
groups => 'testuser',
373+
password => if ($facts['os']['family'] == 'windows') { 'CorrectHorseBatteryStaple0!' },
372374
}
373375
MANIFEST
374376

0 commit comments

Comments
 (0)