Closed subeditara closed 9 months ago
This is not a puppet problem. That IPv6 address needs to be quoted for YAML to interpret it as a regular string.
platform::dns::resolv::servers:
- fd01::1
- '::ff:10.10.10.1'
For posterity, search for "yaml sexagesimal" which can be seen:
$ ruby -ryaml -e "puts YAML.load('11:00')"
39600
Going to close this.
Does this mean this is ruby issue ?
Python parses this correctly:
python3.9 -c 'import yaml; a=yaml.safe_load("servers: ::ffff:10.10.10.1"); print(a); print(a["servers"]);'
{'servers': '::ffff:10.10.10.1'}
::ffff:10.10.10.1
Ruby parses correctly for ffff::1 but has problem with leading colon (::ffff:10.10.10.1).
ruby --version
ruby 2.7.0p0
ruby -ryaml -e "puts YAML.load('servers: ffff::1')"
{"servers"=>"ffff::1"}
ruby -ryaml -e "a = YAML.load('servers: ::ffff:10.10.10.1'); puts a; puts a['servers']"
{"servers"=>:":ffff:10.10.10.1"}
:ffff:10.10.10.1
In ruby it depends on the version of the yaml library that ruby uses and (I believe) whether the library conforms to YAML 1.1 or 1.2 https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell#sexagesimal-numbers
gem list yaml
yaml (0.3.0)
ruby -ryaml -e "puts YAML.load('59:59')"
215940
Even with latest yaml library and the above result for sexagesimal, means it is YAML 1.1. Looks like this library does not comply with leading :: value. I do not see YAML 1.2 compliance yaml library for ruby to test.
Thank you for all your inputs.
Describe the Bug
puppet lookup gives error when key's value is ::ff:10.10.10.1
Expected Behavior
no error expected
Steps to Reproduce
Steps to reproduce the behavior:
create file /tmp/puppet/hieradata/system.yaml
create file /etc/puppet/hiera.yaml
/opt/puppetlabs/bin/puppet lookup --hiera_config /etc/puppet/hiera.yaml platform::dns::resolv::servers
Environment
wget https://apt.puppet.com/puppet8-release-bulleye.deb dpkg -i puppet8-release-bulleye.deb apt-get update apt-get install puppet-agent /opt/puppetlabs/bin/puppet --version 8.4.0
Additional Context
Error: Could not run: Lookup of key 'platform::dns::resolv::servers' failed: Value for key 'platform::dns::resolv::servers', in hash returned from data_hash function 'yaml_data', when using location '/tmp/puppet/hieradata/system.yaml', has wrong type, expects Puppet::LookupValue, got Array[Any, 2, 2]