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

"Unrecognized arguments" in CLI Example #16

Open
jacohend opened this issue Dec 7, 2017 · 5 comments
Open

"Unrecognized arguments" in CLI Example #16

jacohend opened this issue Dec 7, 2017 · 5 comments

Comments

@jacohend
Copy link

jacohend commented Dec 7, 2017

From the example in the 'confidant help' command, this:

confidant get_service -u "https://confidant-production.example.com" -k "alias/authnz-production" --from myservice-production --to confidant-production --user_type service --region us-west-2 --service myservice-production

yields the error

confidant: error: unrecognized arguments: -u https://confidant-production.example.com -k alias/authnz-production --from myservice-production --to confidant-production --user_type service --region us-west-2

It should yield a url unreachable or kms auth error, not an argument error if the example is correct.

@jacohend
Copy link
Author

jacohend commented Dec 7, 2017

It also appears that the arg usage is incorrect for user_type (there should be a hyphen, not an underscore):

usage: confidant [-h] [--config-files CONFIG_FILES] [--profile PROFILE] [-u URL] [--retries RETRIES] [-k AUTH_KEY] [-l TOKEN_LIFETIME] [--token-version TOKEN_VERSION] [--from _FROM] [--to _TO] [--user-type USER_TYPE] [--mfa] [--assume-role ASSUME_ROLE] [--region REGION] [--log-level LOG_LEVEL] [--version]

@ryan-lane
Copy link
Contributor

Ah. yeah. The example is bad. I'll make a PR for a correct example. Writing python CLIs is kind of a pain. So, Some of the options are global options and some are specific to the subcommand. Easiest way to know which are which:

global arguments:

confidant --help

subcommand specific arguments:

confidant get_service --help

Here's the call I usually use for get_service:

confidant --profile production get_service --service myservice-production

And here's an example of a confidant client config file that would match that call:

production:
  url: https://confidant-production.example.com
  auth_key: alias/authnz-production
  auth_context:
    from: myservice-production
    to: confidant-production
    user_type: service
  token_cache_file: '/run/confidant/token_cache'
  region: us-west-2

@jacohend
Copy link
Author

jacohend commented Dec 7, 2017

Ah, ok. Also, it appears that the example actually needs to have the main get_service command moved to after the auth arguments, like so

confidant -u "https://confidant-production.example.com" -k "alias/authnz-production" --from myservice-production --to confidant-production --user_type service --region us-west-2 get_service --service myservice-production

@ryan-lane
Copy link
Contributor

Yep, everything prior to get_service is a global argument. What you have there looks correct, though user_type should be user-type.

@jacohend jacohend closed this as completed Dec 8, 2017
@ryan-lane
Copy link
Contributor

I'm gonna keep this open until I fix the example in the code.

@ryan-lane ryan-lane reopened this Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants