-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC for Ruby data bag items #79
Conversation
This is somewhat linked to #71 as that would provide a basis for the implementation. |
|
||
Currently, Chef only supports JSON data bag items, and not Ruby. Chef **does** | ||
support having other configuration-based files (such as `environments` and `roles`) | ||
be written in either JSON or Ruby. JSON does not allow comments, so it becomes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the JSON implementation in Chef allows comments and yajl-ruby allows comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lamont-granquist Can you please point me at the documentation (or an example) of a Chef data bag item (JSON) which has comments. I have not been able to find anything online regarding data bag items supporting comments. Because by default, I do not believe that JSON supports comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data bags are missing tests, but environments, nodes and roles have tests:
https://github.com/opscode/chef/blob/master/spec/data/object_loader/environments/test.json
https://github.com/opscode/chef/blob/master/spec/data/object_loader/nodes/test.json
https://github.com/opscode/chef/blob/master/spec/data/object_loader/roles/test.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @lamont-granquist. It would, however, be very helpful to have this comment support noted somewhere, for example in the data bag documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can open an issue or PR against https://github.com/opscode/chef-docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lamont-granquist I've submitted this pull request (#432) against the chef-docs repository to document comment support in data bag items.
I'm not super in favour of this RFC given that comments are supported in JSON data bag files, and that was the main motivation for adding Ruby data bag items. IMO it makes sense to have data bag items as "dumb" pieces of data rather than yet another place where arbitrary ruby code can be added - worth keeping it simple, I feel. |
The .rb files are also not supported by ChefFS and 'knife diff' in particular and arbitrary code makes that whole problem somewhat annoying. I've generally moved towards .json now for everything exclusively. It'd be nice if the upstream yajl repo would accept some patches for allowing trailing commas and single and double quoted strings and other JSON5 extensions. |
My biggest concern is the proposed format isn't like the other Ruby DSLs. It is a single Ruby object expression at the top level of a file, instead of a bunch of method calls on an object. This is technically doable, but definitely a different kind of beast. |
This PR is closed in preference to this work being done as part of the dialects RFC. |
No description provided.