Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module fails to parse backend values when they are ruby symbols #289

Open
mvsm opened this issue Sep 25, 2020 · 0 comments · May be fixed by #288
Open

Module fails to parse backend values when they are ruby symbols #289

mvsm opened this issue Sep 25, 2020 · 0 comments · May be fixed by #288

Comments

@mvsm
Copy link

mvsm commented Sep 25, 2020

hiera_spec.tar.gz

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.9 and 6.8.0

  • Ruby:
    OS :ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu] and ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
    Puppetserver 4: jruby 1.7.26 (1.9.3p551) 2016-08-26 69763b8 on OpenJDK 64-Bit Server VM 1.8.0_131-8u131-b11-1~bpo8+1-b11 +jit [linux-amd64]
    Puppetserver 6: jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-1~bpo8+1-b11 +jit [linux-x86_64]

  • Distribution: Debian 8

  • Module version: v4.0.0

How to reproduce (e.g Puppet code you use)

I attached a hiera rspec with a couple of tests that summarize the issue.

What are you seeing

The value for a backend key should have been parsed into a Ruby symbol, however, it is being parsed to '":undef"' (quoted undef symbol).

What behaviour did you expect instead

I expected the hiera.yaml.erb template to parse the values of the backend keys to proper ruby symbols.

Output log

....
Failures:

  1) hiera foss puppet 4 other_backends testing gsub and regex
     Failure/Error: expect('!ruby/sym json'.to_yaml.gsub(/---\s+/, '').gsub(/\!ruby\/sym\s/, ':')).to eq ":json\n"
     
       expected: ":json\n"
            got: "\":json\"\n"
     
       (compared using ==)
     
       Diff:
       @@ -1 +1 @@
       -:json
       +":json"
       
     # ./spec/classes/hiera_spec.rb:86:in `block (4 levels) in <top (required)>'

  2) hiera foss puppet 4 other_backends testing redis backend symbol
     Failure/Error: expect(redis[:redis]).to eq(':json')
     
       expected: ":json"
            got: nil
     
       (compared using ==)
     # ./spec/classes/hiera_spec.rb:95:in `block (4 levels) in <top (required)>'

Finished in 11.59 seconds (files took 3.69 seconds to load)
96 examples, 2 failures

Failed examples:

rspec ./spec/classes/hiera_spec.rb:85 # hiera foss puppet 4 other_backends testing gsub and regex
rspec ./spec/classes/hiera_spec.rb:93 # hiera foss puppet 4 other_backends testing redis backend symbol

Any additional information you'd like to impart

@mvsm mvsm linked a pull request Sep 25, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant