Skip to content

Conversation

@Vanders
Copy link

@Vanders Vanders commented May 26, 2016

The following changes make it easier to wrap the wordpress cookbook and control its behaviour:

  1. node.set_unless doesn't do what you might think it does (http://tickets.opscode.com/browse/CHEF-2945), and setting normal attributes makes things awkward. This PR changes the use of set_unless to a guard clause which means that a normal attribute will only be set if no other type of attribute is set. A wrapper cookbook can E.g. load the attribute values from a vault item and set them as default attributes, without having them persist into the node attributes or be over-written by set_unless.
  2. Add the node['wordpress']['db']['install'] attribute that allows the wrapper to control the MySQL installation. For example I'm installing into a cloud (GCE) instance and wish to use the GCE MySQL instance via. a socket, so I don't need a local MySQL instance and can set the attribute to false to disable it entirely.
  3. A small fix to the is_local_host? helper that allows it to recognise UNIX sockets in the form localhost:/path/to/socket

Vanders added 3 commits May 23, 2016 21:53
set_unless doesn't really do what you might think it does, and makes it
difficult to set the various attributes in a wrapper cookbook, so change
set_unless to a guard that checks if the attribute has been set instead.
Change is_local_host? to check for sockets in the form "host:/path/to/socket"
and return false (although I admit that symantic might be wrong)
If the passwords & keys *are* generated, store them in normal attributes so
that they persist across Chef runs.
Add the node['db']['install'] attribute and add it to the guard on the db
installation process so that a wrapper cookbook can choose to entirely disable
the DB setup if it wishes.
Fix the helper to return true on localhost sockets (E.g.
'localhost:/path/to/socket').
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant