Hi,
I think there's nothing wrong with << operation itself. I just don't think that it's correct to operate with override in this case. First you should keep in mind that the attributes are merged between nodes, roles and environments. In other words, when two cookbooks are assigning the same default attribute on the node level (doesn't meter in attribute file or recipe) the later cookbook's value will win. Say you have run_list of two cookbooks ['foo', 'bar']. foo/attributes/default.rb default['foo']['arr'] = ['Array', 'in', 'foo'] bar/recipes/default.rb default['foo']['arr'] = ['I', 'want', 'foo'] The later value wins, and when template from cookbook foo will render node['foo']['arr'] attribute. We end up with not that we want. We want the arrays to be merged but it won't happen. That's why, in the source cookbook we define array and later cookbooks can use it on the same level, however we must use << (push) for an array, because an assignment will overwrite everything. My shorewall cookbook operates on default level, you can easily use add_shorewall_rules, add_shorewall_zone definitions right away in any of your recipes. Further you might want to added some hard-coded rules or zones use role and environment default attributes. If you might want to override anything you can use normal, override attributes in cookbooks, roles or environments. Everything should work as you expect. Regards, Denis On 19/02/14 16:32, aL. wrote: " type="cite"> |
Archive powered by MHonArc 2.6.16.