Puppet Version: 7.21.0 Puppet Server Version: latest OS Name/Version: Windows Server 2019+ When managing a lot of "hosts" resources on Windows (by means of collecting exported resources), the first ones are applied without problems, but later ones fail with
Error: Puppet::Util::FileType::FileTypeFlat could not write C:/Windows/System32/drivers/etc/hosts: Permission denied @ rb_sysopen - C:/Windows/System32/drivers/etc/hosts
which looks like some kind of race condition to me. Steps to reproduce: Apply the following class on a new Windows host when Puppet is already managing at least 20 or 30 other hosts, all of which have the same class applied:
class hosts { |
# Let each host create a host entry as exported resource |
$nic = $facts['networking']['primary'] |
$ip = $facts['networking']['interfaces'][$nic]['ip'] |
|
@@host { $facts['networking']['fqdn']: |
comment => 'Host entry generated by Puppet', |
host_aliases => [$facts['networking']['hostname']], |
ip => $ip, |
tag => ['HOST_RECORD'], |
} |
|
# Collect all exported host records and add them to (C:/Windows/System32/drivers)/etc/hosts |
Host <<| tag == 'HOST_RECORD' |>> { ensure => present } |
}
|
Desired Behavior: All host resources are applied w/o error in the same Puppet run on Windows. Actual Behavior: See above. |