Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 6104

Hiera -- can't convert Fixnum into String

$
0
0
I'm trying to use a trick similar to the one here https://docs.puppet.com/hiera/1/variables.html where (instead of a fact) I define a variable in my node definition, and then use the value of that variable to possibly find a data source in hiera. My hiera.yaml looks like this: :hierarchy: - %{hostname} - "sts_%{::sts}" - global global.yaml includes this line: test3::one: global sts_1.yaml includes this line: test3::one: sts_1.yaml and my test3 class is class test3 ( $one = "xxxxx one", ) { notify { "module $hostname $module_name: \$one $one" : } } When I use this node node 'agent3' { include test3 } I get the answer I expect > Notice: module agent3 test3: $one global But when I set my variable node 'agent3' { $sts=1 include test3 <- this is line 25 } I get an error > Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Error from DataBinding 'hiera' while looking up 'test3::one': can't convert Fixnum into String at /etc/puppet/manifests/site.pp:25:3 on node agent3 When I change my node node 'agent3' { $sts="1" include test3 } Then it works again > Notice: module agent3 test3: $one sts_1.yaml So clearly, the problem is the variable being passed as the number 1 rather than the string "1". However, the doc https://docs.puppet.com/hiera/1/variables.html tells me that it should be OK to do this: > Hiera can only interpolate variables whose values are strings. (Numbers from Puppet are also passed as strings and can be used safely.) So ... what am I doing wrong?

Viewing all articles
Browse latest Browse all 6104

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>