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

knife vault download doesn't work? #174

Open
szymonpk opened this issue Jun 3, 2015 · 2 comments
Open

knife vault download doesn't work? #174

szymonpk opened this issue Jun 3, 2015 · 2 comments
Labels
Aspect: Documentation How do we use this project? Type: Enhancement Adds new functionality.

Comments

@szymonpk
Copy link

szymonpk commented Jun 3, 2015

$ knife vault create foo bar
# put some data
$ knife vault download foo bar ~/file
Saved  as /Users/szymon/file
$ cat ~/file # empty file, 0 bytes
$

I'm using vault 2.6.1 with chef 12.2.1. For now I'm using knife download data_bags/foo/ as pointed out by @jtimberman.

@jf647
Copy link
Contributor

jf647 commented Jun 3, 2015

The docs on this are poor. It says that you use it to "Decrypt and download an encrypted file to the specified path." What it should point out is that it's the inverse of knife vault create --file FILENAME.

When you use --file to create a vault, it creates two keys in the vault item: file-name and file-content.

So knife vault download opens up the vault item, then writes whatever it finds in the file-content key to a file named using the file-name key. In your case these are presumably not found because you have free-form data in your vault.

To be honest, this is a subcommand that I'd like to kill off in v3.0, but for now there are a few ways to approach it:

  1. Fix up the docs so people have a reasonable expectation of what it does
  2. Have it throw a useful error if the vault doesn't have a file-content and file-name key

Probably a combination of both so the error points people to docs that explain it as I have above.

Is your use case to get the raw JSON of the vault? In that case, knife vault show VAULT ITEM -f json will do what you want.

If on the other hand you're trying to get the encrypted content for archival purposes, then knife download data_bags/VAULT/ITEM or knife data bag show VAULT ITEM -f json and knife data bag show VAULT ITEM_keys -f json are what you're looking for.

@jf647 jf647 added this to the v2.7.0 milestone Jun 3, 2015
@szymonpk
Copy link
Author

szymonpk commented Jun 8, 2015

Thanks for clarification, 1. would be fine for me ;-) 1 & 2 would be awesome.

@thommay thommay added Type: Enhancement Adds new functionality. and removed enhancement labels Jan 25, 2017
@kamaradclimber kamaradclimber removed this from the v2.7.0 milestone Nov 19, 2017
@tas50 tas50 added Aspect: Documentation How do we use this project? and removed Type: Documentation labels Dec 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aspect: Documentation How do we use this project? Type: Enhancement Adds new functionality.
Projects
None yet
Development

No branches or pull requests

5 participants