Change attributes from symbols to strings #61

dkingofpa opened this Issue Jul 11, 2012 · 0 comments


None yet
1 participant

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 was assigned Jul 11, 2012

@dkingofpa dkingofpa pushed a commit that referenced this issue Aug 9, 2012

David King [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.

dkingofpa closed this Aug 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment