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

Projects
None yet
2 participants
@joeyates
Collaborator

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.

Add an option to create a data bag from JSON data in a file.
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

This comment has been minimized.

Show comment
Hide comment
@joeyates

joeyates May 28, 2013

Collaborator

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
Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@thbishop

thbishop May 31, 2013

Owner

@joeyates makes sense. thanks for the pull request.

Owner

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

Merge pull request #10 from joeyates/master
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

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