Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

ekrupnik
Copy link

@ekrupnik ekrupnik commented Jan 6, 2015

No description provided.

@ekrupnik ekrupnik closed this Jan 6, 2015
@ekrupnik ekrupnik reopened this Jan 6, 2015
@ekrupnik ekrupnik changed the title Initial RFC for Ruby data bag items RFC for Ruby data bag items Jan 6, 2015
@coderanger
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

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.

Copy link
Contributor

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

Copy link
Author

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.

@jonlives
Copy link
Contributor

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.

@lamont-granquist
Copy link
Contributor

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.

@coderanger
Copy link
Contributor

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.

@adamhjk
Copy link
Contributor

adamhjk commented Feb 19, 2015

This PR is closed in preference to this work being done as part of the dialects RFC.

@adamhjk adamhjk closed this Feb 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants