Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Change attributes from symbols to strings #61

Closed
dkingofpa opened this Issue · 0 comments

1 participant

@dkingofpa
Owner

When first starting with chef, I wasn't sure whether to use symbols or strings. Opscode's own cookbooks appeared to go both ways and they didn't really promote one or the other. I chose symbols thinking that was the "ruby way". However, there are still a number of inconsistencies with attribute names. For example, there are times in json when we need to pass in a string for a setting (such as initdb's database name and user name). Mixing symbols and strings for array keys in json just looks messy and is inconsistent. There are even some cases where the attribute name is defined as a string, but we use a symbol (see json in Vagrantfile for mysql).

Now Opscode promotes using strings for attributes. See Notation section. (edit 8/9/12: it's in an older version of the wiki page)

We'll need to first make these changes in all our cookbooks. Then we can update our Cheffile with the new cookbook versions and json to use strings for attributes.

@dkingofpa dkingofpa was assigned
@dkingofpa dkingofpa referenced this issue from a commit
@dkingofpa dkingofpa [GH-61] Use strings instead of symbols for keys
For the json in the Vagrantfile, the attribute arrays are now keyed
by strings rather than ruby symbols. Its more consistent with other
cookbooks. Opscode also prefers if people use string keys.
ca1ec73
@dkingofpa dkingofpa closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.