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

Add an option to create a data bag from JSON data in a file #10

Merged
merged 1 commit into from May 31, 2013

Conversation

@joeyates
Copy link
Collaborator

@joeyates joeyates commented May 28, 2013

An option --json-file is added that takes a file path.
I.e.

$ knife solo data bag create my_bag my_item --json-file foo.json

The file's contents are loaded and used as the contents of the new
data bag.

An option --json-file is added that takes a file path.
I.e.

  $ knife solo data bag create my_bag my_item --json-file foo.json

The file's contents are loaded and used as the contents of the new
data bag.
@joeyates
Copy link
Collaborator Author

@joeyates joeyates commented May 28, 2013

I forgot to mention the motivation!
I have sets of very similar credentials spread across various kitchens. I can export data to file as raw JSON, but I can't easily re-import it into a different kitchen (I've tried using --json with a string, but it's prone to problems with escape characters).
This added option allows me to output to a file, and re-import elsewhere.
For example:

$ knife solo data bag show my_bag my_item -F json > foo.json

...copy to another project/edit as clear text...

$ knife solo data bag create my_bag my_item --json-file foo.json
@thbishop
Copy link
Owner

@thbishop thbishop commented May 31, 2013

@joeyates makes sense. thanks for the pull request.

thbishop added a commit that referenced this pull request May 31, 2013
Add an option to create a data bag from JSON data in a file
@thbishop thbishop merged commit 2a3f757 into thbishop:master May 31, 2013
1 check passed
1 check passed
default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.