I’ve got two cookbooks, one is for managing firewall and second is for let’s
say apache for example. Firewall cookbook defines attribute :ports which is an
array of ports that should be open.
Is there any way how apache can add it’s :listen_port to array of :ports? It
should first verify, that attribute :ports exists then check whether the port
is already in array and finally add it if it’s missing.
So you can include another cookbooks attributes file to make sure that
the attributes there are available in the current cookbook.
On Jan 29, 2010, at 2:44 AM, Ares wrote:
Hello,
I've got two cookbooks, one is for managing firewall and second is
for let's
say apache for example. Firewall cookbook defines attribute :ports
which is an
array of ports that should be open.
Is there any way how apache can add it's :listen_port to array
of :ports? It
should first verify, that attribute :ports exists then check whether
the port
is already in array and finally add it if it's missing.
Ohai!
If you'd like to stick with 0.7.16, you can use set_unless to set the
attribute to an emtpy array if it doesn't exist, then append a port to
the array with the << operator (or use the push or unshift methods).
There's no way in 0.7.16 to ensure that a given set of attributes is
loaded before another, so you'll want to put the set_unless in both
attribute files.
So you can include another cookbooks attributes file to make sure that the attributes there are available in the current cookbook.
On Jan 29, 2010, at 2:44 AM, Ares wrote:
Hello,
I've got two cookbooks, one is for managing firewall and second is for let's
say apache for example. Firewall cookbook defines attribute :ports which is an
array of ports that should be open.
Is there any way how apache can add it's :listen_port to array of :ports? It
should first verify, that attribute :ports exists then check whether the port
is already in array and finally add it if it's missing.