ghoneycutt / puppet-module-hosts

Puppet module to manage host entries

Repository from Github https://github.comghoneycutt/puppet-module-hostsRepository from Github https://github.comghoneycutt/puppet-module-hosts

Evaluating localhost if array or string fails as it's a tuple by default.

faircreek opened this issue · comments

The error below happens no matter you use default localhost alias in the module or if you specify your own localhost aliases, setting, setting localhost_enabled to false will from what I see always trigger this error too as it will set the type to undef.

I'm running latest version of Centos 8

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, hosts::localhost_aliases must be a string or an array. Detected type is <Tuple[String, String]>. (file: /opt/puppet-modules/production/base/hosts/manifests/init.pp, line: 93, column: 5) on node puppetmaster

This was due to puppet installing very early version when you have stdlib 6.5.0 installed.

Can reproduce. What was your fix?

I have the same issue with puppetlabs-stdlib v6.6.0 with puppet 7.14 installed.

Default values for are localhost_aliases is:
$localhost_aliases = ['localhost',
'localhost4',
'localhost4.localdomain4'],
= <Tuple[String, String, String]>.
Error:
hosts::localhost_aliases must be a string or an array. Detected type is <Tuple[String, String, String]>.

When I set it up with a String in hiera I get this:
hosts::localhost_aliases: "localhost localhost4 localhost4.localdomain4"

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, hosts::localhost_aliases must be a string or an array. Detected type is <String>. (file: /etc/puppetlabs/code/modules/hosts/manifests/init.pp, line: 93, column: 5) on node ...

the puppet code in the module that generates this error is:
if $my_localhost_aliases_type != 'string' and $my_localhost_aliases_type != 'array' {
fail("hosts::localhost_aliases must be a string or an array. Detected type is <${my_localhost_aliases_type}>.")
}

Default value-type "Tuple[String, String, String]" does not match code (is_string or is_array).

Any solution for that ?

Closing as we have simplified the module with v3.0.0