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

Remove Puppet 4 Warning - delete :undef symbols in attr hash #222

Merged
merged 1 commit into from
Jan 31, 2017
Merged

Remove Puppet 4 Warning - delete :undef symbols in attr hash #222

merged 1 commit into from
Jan 31, 2017

Conversation

Reamer
Copy link
Contributor

@Reamer Reamer commented Jan 30, 2017

:undef is a symbol and can't not converted correctly to json
https://github.com/puppetlabs/puppet/blob/89205d63a831deb732276d9b1bc412d45e7a6567/lib/puppet/resource.rb#L119

Without this fix we get this warning on every catalogue compilation
https://github.com/puppetlabs/puppet/blob/89205d63a831deb732276d9b1bc412d45e7a6567/lib/puppet/resource.rb#L91

Example warning:

2017-01-30 16:47:14,133 WARN  [qtp909448294-67] [puppetserver] Puppet Resource 'Icinga2::Object[icinga2::object::ApiListener::api]' contains a Hash value. It will be converted to the String '{"cert_path"=>"/etc/icinga2/pki/webserver.xxxxxxx.de.crt", "key_path"=>"/etc/icinga2/pki/webserver.xxxxxx.de.key", "ca_path"=>"/etc/icinga2/pki/ca.crt", "accept_commands"=>true, "accept_config"=>true, "ticket_salt"=>"TicketSalt", "tls_protocolmin"=>:undef, "cipher_list"=>:undef}'

@bobapple
Copy link
Contributor

thx @Reamer 👍

@bobapple bobapple merged commit a87ae6f into voxpupuli:master Jan 31, 2017
@erezzarum
Copy link

Sorry to bring this case up, but it introduced a new bug
OK

foo => {
  bar => { }
}
Results:
vars.foo["bar"] = {
}

OK

foo1 => [ 'bar1' ] 
Results:
vars.foo1 = [ "bar1 "]

Fail

foo2 => {
  bar2 => [ 'bar3', 'bar4', ],
}
Results:
vars.foo2bar2 = [ "bar3", "bar4" ]

Expected:
vars.foo2["bar2"] = [ "bar3", "bar4" ]

OK

foo3 => {
 bar => {
  bar1 => { },
}
Results:
vars.foo3["bar"] = {
  bar1 = {        
  }               
}                 

Fail

foo4 => { }
Results: 
Removed (does not exist)

Expected: 
vars.foo4 = {
}

Fail

foo5 => {
  bar1 => [ 'bar2', 'bar3', ],
  bar4 => { bar5 => 'bar6' },
}
Results:
vars.foo5bar1 = [ "bar2", "bar3", ]     
vars.foo5["bar4"] = {                   
  bar5 = "bar6"                         
}
                            
Expected:
vars.foo5["bar1"] = [ "bar2", "bar3" ]
vars.foo5["bar4"] = {
  bar5 = "bar6"
}  

Fail

foo6 => {
  bar1 => { bar2 => 'bar3' },
  bar4 => [ 'bar5', 'bar6', ],
}
Results:
vars.foo6["bar1"] = {                
  bar2 = "bar3"                      
}                                    
vars.foo6bar4 = [ "bar5", "bar6", ]  

Expected: 
vars.foo6["bar1"] = {
  bar2 = "bar3"
}
foo6["bar4"] = [ "bar5", "bar6" ]

OK

foo7 => {
        bar1 => { bar2 => 'bar3', bar4 => 'bar5', },
}
Results:
vars.foo7["bar1"] = {
  bar2 = "bar3"
  bar4 = "bar5"
}

@erezzarum
Copy link

My bad, i'm sorry, it's related to the icinga2_attributes, (utils.rb)

@Reamer
Copy link
Contributor Author

Reamer commented Jan 31, 2017

Thanks for taking a deep look into this behaviour. @bobapple I think we should open an issue with all examples from @erezzarum.

I see a problem with this structure:

foo2 => {
  bar2 => [ 'bar3', 'bar4', ],
}
Results:
vars.foo2bar2 = [ "bar3", "bar4" ]

Expected:
vars.foo2["bar2"] = [ "bar3", "bar4" ]

The result from the following structure should be good.

foo4 => { }
Results: 
Removed (does not exist)

Expected: 
vars.foo4 = {
}

Best Regards
Reamer

@erezzarum
Copy link

I fixed it, i'll submit a pull request

@bobapple bobapple added this to the v1.1.0 milestone Mar 13, 2017
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 this pull request may close these issues.

3 participants