You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding many host entries on Windows, using host resources, some sometimes fail with
Puppet::Util::FileType::FileTypeFlat could not write C:/Windows/System32/drivers/etc/hosts: Permission denied @ rb_sysopen - C:/Windows/System32/drivers/etc/hosts
while the other ones are added just fine.
Expected Behavior
All host entries should be added w/o error
Steps to Reproduce
Use the following class to add many host entries to a new Windows node (possibly in a setup with at least 20-30 other nodes):
classhosts {
# 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 }
}
Environment
Version: 7
Platform: Windows Server 20xx
Additional Context
Could work around/fix the problem with the following patch:
*** /usr/lib/ruby/vendor_ruby/puppet/util/filetype.rb 2023-02-07 22:38:26.000000000 +0100--- Windows/filetype.rb 2024-11-28 10:46:10.605288810 +0100****************** 127,132 ****--- 127,133 ----
File.chmod(@default_mode, tf.path) if @default_mode
FileUtils.cp(tf.path, @path)
tf.close
+ sleep(0.1) if Facter.value(:kernel) == 'windows'
# If SELinux is present, we need to ensure the file has its expected context
set_selinux_default_context(@path)
end
The text was updated successfully, but these errors were encountered:
Describe the Bug
When adding many host entries on Windows, using
host
resources, some sometimes fail withwhile the other ones are added just fine.
Expected Behavior
All host entries should be added w/o error
Steps to Reproduce
Use the following class to add many host entries to a new Windows node (possibly in a setup with at least 20-30 other nodes):
Environment
Additional Context
Could work around/fix the problem with the following patch:
The text was updated successfully, but these errors were encountered: