fugue / credstash

A little utility for managing credentials in the cloud
Apache License 2.0
2.06k stars 214 forks source link

`--key` option not recognized #126

Closed mblakele closed 7 years ago

mblakele commented 7 years ago

Thanks for releasing credstash. It looks useful, but I'm having trouble with a custom key name. If this isn't a bug, please let me know where I'm going wrong.

$ credstash --key alias/credstash-us-west-2 list
usage: credstash [-h] [-r REGION] [-t TABLE] [-p PROFILE | -n ARN]
                 {delete,get,getall,list,put,setup} ...
credstash: error: invalid choice: 'alias/credstash-us-west-2' (choose from 'delete', 'get', 'getall', 'list', 'put', 'setup')
$ credstash -k alias/credstash-us-west-2 list
usage: credstash [-h] [-r REGION] [-t TABLE] [-p PROFILE | -n ARN]
                 {delete,get,getall,list,put,setup} ...
credstash: error: invalid choice: 'alias/credstash-us-west-2' (choose from 'delete', 'get', 'getall', 'list', 'put', 'setup')

It seems like -k and --key aren't recognized. I don't see them in --help either, but they're in https://github.com/fugue/credstash/blob/master/README.md and https://github.com/fugue/credstash/blob/master/credstash.py

$ credstash --version
usage: credstash [-h] [-r REGION] [-t TABLE] [-p PROFILE | -n ARN]
                 {delete,get,getall,list,put,setup} ...
credstash: error: too few arguments
$ credstash --help
usage: credstash [-h] [-r REGION] [-t TABLE] [-p PROFILE | -n ARN]
                 {delete,get,getall,list,put,setup} ...

A credential/secret storage system

positional arguments:
  {delete,get,getall,list,put,setup}
                        Try commands like
                        "/Users/michael.b/Source/fubar/pyenv/bin/credstash get
                        -h" or
                        "/Users/michael.b/Source/fubar/pyenv/bin/credstash put
                        --help" to get each sub command's options
    delete              Delete a credential from the store
    get                 Get a credential from the store
    getall              Get all credentials from the store
    list                list credentials and their versions
    put                 Put a credential into the store
    setup               setup the credential store

optional arguments:
  -h, --help            show this help message and exit
  -r REGION, --region REGION
                        the AWS region in which to operate. If a region is not
                        specified, credstash will use the value of the
                        AWS_DEFAULT_REGION env variable, or if that is not
                        set, the value in `~/.aws/config`. As a last resort,
                        it will use us-east-1
  -t TABLE, --table TABLE
                        DynamoDB table to use for credential storage
  -p PROFILE, --profile PROFILE
                        Boto config profile to use when connecting to AWS
  -n ARN, --arn ARN     AWS IAM ARN for AssumeRole

Other info that might help:

$ pip install -U credstash
Requirement already up-to-date: credstash in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages
Requirement already up-to-date: cryptography~=1.5 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from credstash)
Requirement already up-to-date: boto3>=1.1.1 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from credstash)
Requirement already up-to-date: setuptools>=11.3 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from cryptography~=1.5->credstash)
Requirement already up-to-date: enum34 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from cryptography~=1.5->credstash)
Requirement already up-to-date: ipaddress in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from cryptography~=1.5->credstash)
Requirement already up-to-date: pyasn1>=0.1.8 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from cryptography~=1.5->credstash)
Requirement already up-to-date: six>=1.4.1 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from cryptography~=1.5->credstash)
Requirement already up-to-date: idna>=2.0 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from cryptography~=1.5->credstash)
Requirement already up-to-date: cffi>=1.4.1 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from cryptography~=1.5->credstash)
Requirement already up-to-date: s3transfer<0.2.0,>=0.1.10 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from boto3>=1.1.1->credstash)
Requirement already up-to-date: jmespath<1.0.0,>=0.7.1 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from boto3>=1.1.1->credstash)
Requirement already up-to-date: botocore<1.5.0,>=1.4.1 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from boto3>=1.1.1->credstash)
Requirement already up-to-date: pycparser in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from cffi>=1.4.1->cryptography~=1.5->credstash)
Requirement already up-to-date: futures<4.0.0,>=2.2.0 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from s3transfer<0.2.0,>=0.1.10->boto3>=1.1.1->credstash)
Requirement already up-to-date: python-dateutil<3.0.0,>=2.1 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Requirement already up-to-date: docutils>=0.10 in /Users/mblakele/Source/fubar/pyenv/lib/python2.7/site-packages (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)

I also tried pip install -U 'git+ssh://git@github.com/fugue/credstash': no different.

alex-luminal commented 7 years ago

--key is only used on a put.

mblakele commented 7 years ago

Unexpected syntax:

credstash --region $region --table $table put --key $key name value

That is, the global options have to come before the action, and action-specific option(s) must follow it.