[chef] Re: Re: LWRP attributes + template


Chronological Thread 
  • From: "aL." < >
  • To:
  • Subject: [chef] Re: Re: LWRP attributes + template
  • Date: Wed, 19 Feb 2014 09:32:48 +0000

Hi!

I have seen that you are appending to the rules array  on the rule definition: node.default['shorewall']['rules'] << Shorewall.compute_rule(rule, data)

Im still asking myself if that is the correct way to do things and if there is any other way of having all rules(even those adde from other cookbooks) on attributes when you render the template on your shorewall cookbook.

Im going to ask again ¿Is there any pattern about this?

Thanks for your repply.

--
Si necesitas una máquina para hacer algo y no la compras al final te darás cuenta de que has pagado lo mismo y no tienes la máquina.--Henry Ford
Alberto


On Tue, Feb 18, 2014 at 3:27 PM, Denis Barishev < " target="_blank"> > wrote:
Hello,

I didn't like that way node.override[:shorewall][:rules] << {<rulehash>}. Have a look at my cookbook with an already formed view onto attributes and their usage. Long time ago it was based on community one, but since it has changed a lot.

https://github.com/dennybaa/shorewall

Regards,
Denis


On 18/02/14 22:04, aL. wrote:
Hi, reading the README of shorewall community cookbok[1] it says that you can declare rules by:

- Doing node.override[:shorewall][:rules] << {<rulehash>} on recipes.
- A library helper method add_shorewal_rules() that wil << on rules attribute also.

I have tested that doing that "append" on override attributes, template does not need lazy attributes. I dont know why, but it works, even if you add a rule later on the runlist, on an apache2_app recipe to open 8080.

I wanted to make an LWRP to declare rules on an idempotentially way, but you cant modify attributes on providers. At least those modifications are not available when template renders..


My questions: 


- ¿Is this the right way of defining attributes with that override << stuff?
- ¿Is there any pattern for that situation where your application cookbook should open a port on the firewall and you du it by adding a shorewall rule? Attributes and then render to template sounds good but that override << is an ungly thing :S


Thanks in advance guys!




--
Si necesitas una máquina para hacer algo y no la compras al final te darás cuenta de que has pagado lo mismo y no tienes la máquina.--Henry Ford
Alberto





Archive powered by MHonArc 2.6.16.

§