{"action":"created","issue":{"url":"https://api.github.com/repos/chef/chef/issues/5360","repository_url":"https://api.github.com/repos/chef/chef","labels_url":"https://api.github.com/repos/chef/chef/issues/5360/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef/issues/5360/comments","events_url":"https://api.github.com/repos/chef/chef/issues/5360/events","html_url":"https://github.com/chef/chef/pull/5360","id":178365379,"number":5360,"title":"Chef 12 Attribute Regression","user":{"login":"gbagnoli","id":698996,"avatar_url":"https://avatars.githubusercontent.com/u/698996?v=3","gravatar_id":"","url":"https://api.github.com/users/gbagnoli","html_url":"https://github.com/gbagnoli","followers_url":"https://api.github.com/users/gbagnoli/followers","following_url":"https://api.github.com/users/gbagnoli/following{/other_user}","gists_url":"https://api.github.com/users/gbagnoli/gists{/gist_id}","starred_url":"https://api.github.com/users/gbagnoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbagnoli/subscriptions","organizations_url":"https://api.github.com/users/gbagnoli/orgs","repos_url":"https://api.github.com/users/gbagnoli/repos","events_url":"https://api.github.com/users/gbagnoli/events{/privacy}","received_events_url":"https://api.github.com/users/gbagnoli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-09-21T14:34:40Z","updated_at":"2016-09-23T18:36:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chef/chef/pulls/5360","html_url":"https://github.com/chef/chef/pull/5360","diff_url":"https://github.com/chef/chef/pull/5360.diff","patch_url":"https://github.com/chef/chef/pull/5360.patch"},"body":"## Summary\r\n\r\nChef-12 changes the behaviour of how attributes that are defined as literal arrays are handled, such as they do not longer work as they did in Chef-11\r\n\r\ngiven an attributed defined as an array of hashes\r\n\r\n```\r\nnode['foo'] = [ {'key' => 'value'} ]\r\n```\r\n\r\nin Chef-11 accessing using symbols or strings works seamlessly, while in Chef-12 yields different results, i.e.\r\n\r\n```\r\nnode['foo'].first['key'] == node['foo'].first[:key]  \r\n\r\n```\r\nreturns `true` in Chef-11 and `false` in Chef 12, as in the latter `node['foo'].first[:key]` is `nil`\r\n\r\nI created [a gist with a really basic cookbook](https://gist.github.com/gbagnoli/7fc007c3f67869faf8081f9f584268b4) that shows the problem -- `result_unpatched.txt` is the rendered template using code from master and `result_patched.txt` contains the same template rendered with the patched code from this PR\r\n\r\n## To replicate\r\n\r\nSimply add the spec from this PR to master and see it fail.\r\nAdd the same spec to `11-stable` branch and it passes :)\r\n\r\n## Explanation\r\n\r\n`VividMash`, unlike `Mash`, does not recursively convert values inside\r\narrays, just the array itself.\r\nAs such, hashes inside arrays are not converted to *Mash, introducing\r\na behaviour that differs from Chef 11\r\n\r\nThis PR fixes `VividMash` so arrays are recursively converted and the\r\nbehaviour restored, plus it `immutablize` `merge_all` return value, so to be sure that hashes contained in Arrays are properly immutablized as well, ensuring that non-existing attributes\r\nare **not** automatically vivified (which would make them return an empty `VividMash`\r\ninstead of `nil`)\r\n\r\nThis problem was first reported in chef/chef#2871.\r\n\r\nSigned-off-by: Giacomo Bagnoli <gbagnoli@gmail.com>"},"comment":{"url":"https://api.github.com/repos/chef/chef/issues/comments/249269891","html_url":"https://github.com/chef/chef/pull/5360#issuecomment-249269891","issue_url":"https://api.github.com/repos/chef/chef/issues/5360","id":249269891,"user":{"login":"lamont-granquist","id":454857,"avatar_url":"https://avatars.githubusercontent.com/u/454857?v=3","gravatar_id":"","url":"https://api.github.com/users/lamont-granquist","html_url":"https://github.com/lamont-granquist","followers_url":"https://api.github.com/users/lamont-granquist/followers","following_url":"https://api.github.com/users/lamont-granquist/following{/other_user}","gists_url":"https://api.github.com/users/lamont-granquist/gists{/gist_id}","starred_url":"https://api.github.com/users/lamont-granquist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lamont-granquist/subscriptions","organizations_url":"https://api.github.com/users/lamont-granquist/orgs","repos_url":"https://api.github.com/users/lamont-granquist/repos","events_url":"https://api.github.com/users/lamont-granquist/events{/privacy}","received_events_url":"https://api.github.com/users/lamont-granquist/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T18:36:42Z","updated_at":"2016-09-23T18:36:42Z","body":"sweet!  yeah, i went through this and convinced myself that your code is correct (i had to go down a few dead ends myself before i wound up with basically the same code), but i think i want to pull the tests i just wrote instead -- and i was just gonna ask if you could click that sweet new button =)"}}
{"actor":{"display_login":"lamont-granquist"}}