Reputation: 445
I am using version 3.8 of puppet and I need to convert an ip address to a string. I tried the String function but I am getting an error.
This is the code I am using:
class resolver::params {
$ip = String($::ipaddress)
$octs = split($ip, '.')
file{ '/tmp/teste.txt':
content => $octs[0]
}
}
Here is the output:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at '('; expected ')' at /etc/puppet/modules/resolver/manifests/params.pp:2 on node example.intranet.example.br
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Upvotes: 1
Views: 1597
Reputation: 16263
You can use string interpolation, with the facter variable as the expression to be evaluated, i.e.:
$ip = "${::ipaddress}"
Upvotes: 3