Open
Conversation
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').
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following changes make it easier to wrap the wordpress cookbook and control its behaviour:
node.set_unlessdoesn'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.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 tofalseto disable it entirely.is_local_host?helper that allows it to recognise UNIX sockets in the formlocalhost:/path/to/socket