Conjurinc-workato-dev / appliance

0 stars 0 forks source link

bugA more intuitive error exists when user attempts to login before initializing the CLI #79

Open InbalZilberman opened 3 years ago

InbalZilberman commented 3 years ago

Summary

When the .conjurrc does not exist (created during conjur init) and the user attempts to login (conjur login), they get the error Error: No such file or directory: '/Users/ssax/.conjurrc'. This is not a create user experience because it does not tell the user what has happened or why it has happened

Steps to Reproduce

Steps to reproduce the behavior:

  1. Remove .conjurrc if exists on your machine
  2. Run conjur login -i admin -p <somepass>
  3. See error Error: No such file or directory: '/Users/ssax/.conjurrc'

Expected Results

One of following:

  1. Prompt them to initialize the client (run init and then run the remaining command (conjur login)
  2. Return informative error Error: You have not initalize the client. Run "conjur init" and try again.
  3. Any other options you see fit

Reproducible

Environment setup

Dev environment on local macOS machine. See here

Additional Information

The flow should be smart enough to cover when a user provides flags and when they don't. In other words it would be great to have some sort of input validation.

For example, the following immediately prompts the error ./pkg_bin/conjur login -i admin -p <somepass>

BUT the following does not and requests user interaction

./pkg_bin/conjur login
Enter your login name to log into Conjur:

Some input validation already exists but this might not be the proper place. Consider taking a look at this for inspiration and see there is a better place for all input validations: https://github.com/cyberark/conjur-api-python3/blob/master/conjur/cli.py#L727

DOD