| Puppet Version: verified on 5.5.x and 6.x Puppet Server Version: 2018.1 OS Name/Version: CentOS 7.5.1804 It's impossible to provide a valid array of host_aliases to the Host resource from the 'puppet resource' command line, due to an erroneous validation error in the Host type definition. On lines 39-41 of /opt/puppetlabs/puppet/vendor_modules/host_core/lib/puppet/type/host.rb it defines the array delimiter as a space:
while on line 49 it raises on error if the input contains a space:
raise Puppet::Error, _('Host aliases cannot include whitespace') if value =~ %r{\s}
|
This naturally leads to an impossible situation, where the only working option is an array of 1 item. Desired Behavior: When specifying an array of host_aliases, the delimiter should be different from the validation for not using a whitespace. Actual Behavior: According to the type definition, this should be the correct command for puppet resource type:
However, this gives the following error, caused by line 49 in host.rb: Error: Could not run: Parameter host_aliases failed on Host[puppet.classroom.puppet.com]: Host aliases cannot include whitespace The user would then naturally think he should use the following command instead, using a different seperator:
This command runs, but results in the following output:
Which is actually a single entry for a host alias called "puppet,master.puppet.vm", which is also wrong. See the resulting entry in /etc/hosts:
As a quick test, I commented out line 49 from the Host type and re-ran the original command, which now succeeds:
|