Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Won't Do
-
PUP 4.10.2, PUP 5.3.2
-
None
-
Needs Assessment
-
Needs Assessment
Description
Hello,
There is a regression in the handling of serialized regexps in yaml ( http://yaml.org/YAML_for_ruby.html#regexps); starting with Puppet 4.10.2 an error occured about a type mismatch.
[ ... ] has wrong type, expects Puppet::LookupValue, got Hash[Regexp[/a.b/] [...] at [...]
Steps to reproduce :
Using Docker, it is easy to reproduce :
In a repository, create the following files
- data/common.yaml
foo::bar:
!ruby/regexp '/a.b/':
'test': {}
- data/hiera5.yaml
---
version: 5
hierarchy:
- name: Common
path: common.yaml
defaults:
data_hash: yaml_data
datadir: /tmp/bug_puppet/data
- data/foo.pp
class foo (
|
$bar = 'Toto',
|
){
|
notify{"${bar}":}
|
}
|
|
node /.*/{
|
class{'foo':}
|
}
|
- Dockerfile
ARG PUPPET_VERSION=latest
|
FROM puppet/puppet-agent:${PUPPET_VERSION}
|
|
RUN mkdir /tmp/bug_puppet/
|
ADD . /tmp/bug_puppet
|
Then run the following commands :
for i in 1.9.3 1.9.2 1.9.1 1.10.1 1.10.2 1.10.3 1.10.4 ; do docker build --build-arg PUPPET_VERSION=$i . -t puppet-test:$i ; done
|
|
for i in 1.9.3 1.9.2 1.9.1 1.10.1 1.10.2 1.10.3 1.10.4 ; do echo "Puppet Version $i "; docker run -it --rm puppet-test:$i apply --hiera_config /tmp/bug_puppet/data/hiera5.yaml /tmp/bug_puppet/data/foo.pp ; done
|
You will see the following output :
for i in 1.9.3 1.9.2 1.9.1 1.10.1 1.10.2 1.10.3 1.10.4 ; do echo "Puppet Version $i "; docker run -it --rm puppet-test:$i apply --hiera_config /tmp/bug_puppet/data/hiera5.yaml /tmp/bug_puppet/data/foo.pp ; done
|
Puppet Version 1.9.3
|
Notice: Compiled catalog for e8d8df813253 in environment production in 0.06 seconds
|
Notice: {(?-mix:a.b) => {test => {}}}
|
Notice: /Stage[main]/Foo/Notify[{(?-mix:a.b) => {test => {}}}]/message: defined 'message' as '{(?-mix:a.b) => {test => {}}}'
|
Notice: Applied catalog in 0.02 seconds
|
Puppet Version 1.9.2
|
Notice: Compiled catalog for 763be4c8093e in environment production in 0.06 seconds
|
Notice: {(?-mix:a.b) => {test => {}}}
|
Notice: /Stage[main]/Foo/Notify[{(?-mix:a.b) => {test => {}}}]/message: defined 'message' as '{(?-mix:a.b) => {test => {}}}'
|
Notice: Applied catalog in 0.02 seconds
|
Puppet Version 1.9.1
|
Notice: Compiled catalog for 51794a142499 in environment production in 0.06 seconds
|
Notice: {(?-mix:a.b) => {test => {}}}
|
Notice: /Stage[main]/Foo/Notify[{(?-mix:a.b) => {test => {}}}]/message: defined 'message' as '{(?-mix:a.b) => {test => {}}}'
|
Notice: Applied catalog in 0.02 seconds
|
Puppet Version 1.10.1
|
Notice: Compiled catalog for b037e978fee2 in environment production in 0.07 seconds
|
Notice: {(?-mix:a.b) => {test => {}}}
|
Notice: /Stage[main]/Foo/Notify[{(?-mix:a.b) => {test => {}}}]/message: defined 'message' as '{(?-mix:a.b) => {test => {}}}'
|
Notice: Applied catalog in 0.02 seconds
|
Puppet Version 1.10.2
|
Error: Evaluation Error: Error while evaluating a Resource Statement, Lookup of key 'foo::bar' failed: Value for key 'foo::bar', in hash returned from data_hash function 'yaml_data', when using location '/tmp/bug_puppet/data/common.yaml', has wrong type, expects Puppet::LookupValue, got Hash[Regexp[/a.b/], Hash[String, Hash[0, 0], 1, 1], 1, 1] at /tmp/bug_puppet/data/foo.pp:8:3 on node cb1a4758863b
|
Puppet Version 1.10.3
|
Error: Evaluation Error: Error while evaluating a Resource Statement, Lookup of key 'foo::bar' failed: Value for key 'foo::bar', in hash returned from data_hash function 'yaml_data', when using location '/tmp/bug_puppet/data/common.yaml', has wrong type, expects Puppet::LookupValue, got Hash[Regexp[/a.b/], Hash[String, Hash[0, 0], 1, 1], 1, 1] at /tmp/bug_puppet/data/foo.pp:8:3 on node 6d6370c009db
|
Puppet Version 1.10.4
|
Error: Evaluation Error: Error while evaluating a Resource Statement, Lookup of key 'foo::bar' failed: Value for key 'foo::bar', in hash returned from data_hash function 'yaml_data', when using location '/tmp/bug_puppet/data/common.yaml', has wrong type, expects Puppet::LookupValue, got Hash[Regexp[/a.b/], Hash[String, Hash[0, 0], 1, 1], 1, 1] at /tmp/bug_puppet/data/foo.pp:8:3 on node 1ff02903420e
|
It was working also on version 1.8.0.
Regards
Olivier