I have a parameter of type Stdlib::Port which I would like to set via the lookup function in my yaml-file.
manifest:
class module1(
Integer $logging_filesize,
Optional[Stdlib::Port] $server_port,
) {
...
}
yaml:
---
public:
port_1: 8080
port_2: 443
module1::server_port: "%lookup('public.port_1')"
But I get the following error:
Error: Evaluation Error: Error while evaluating a Function Call, Class[module1]: parameter 'server_port' expects a Stdlib::Port = Integer[0, 65535] value, got String (line: 1, column: 35) on node xxxx
unfortunately a convert_to of the parameter did not work
lookup_options:
module1::server_port:
convert_to: "Integer"
If it is the same YAML document, you could alias keys. In Puppet there is also an
alias
function.Note, although the
"
delimiter usually suggest a string value, thealias
interpolation function is special: If there is only an%alias{…}
within a value, the data type of the aliased value is preserved.