Is attribute values combination accross cookbooks possible?

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.

Thanks for any reply

ares

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello!

We actually added a helper method to allow better management of this
with CHEF-607:

http://tickets.opscode.com/browse/CHEF-607

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.

Thanks for any reply

ares


Opscode, Inc
Joshua Timberman, Senior Solutions Engineer
C: 720.878.4322 E: joshua@opscode.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAktjD9AACgkQO97WSdVpzT1kIgCeOjhOMEZYunlZ0SRu/eVSvr/P
PNQAn3e9S7NS02twG9tqdnSrV82A/1rz
=t/kO
-----END PGP SIGNATURE-----

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.

HTH,
Dan DeLeo

On Friday, January 29, 2010, Joshua Timberman joshua@opscode.com wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello!

We actually added a helper method to allow better management of this with CHEF-607:

http://tickets.opscode.com/browse/CHEF-607

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.

Thanks for any reply

ares


Opscode, Inc
Joshua Timberman, Senior Solutions Engineer
C: 720.878.4322 E: joshua@opscode.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAktjD9AACgkQO97WSdVpzT1kIgCeOjhOMEZYunlZ0SRu/eVSvr/P
PNQAn3e9S7NS02twG9tqdnSrV82A/1rz
=t/kO
-----END PGP SIGNATURE-----