Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10604 from anastasiamac/askortell-addcredential
#10604 ## Description of change In previous iteration, 'add-credential' command has been upgraded to operate on both local client and on controller. This PR ensures that a user is prompted to confirm to upload a credential to the current controller if one is detected. Drive-by: (*) File can be specified with an -f or --file option for both add-cloud and add-credential commands. ## QA steps (*) Add credential interactively (local since no current nor specified controller) ``` $ juju add-credential aws Enter credential name: sample Regions us-east-1 us-east-2 us-west-1 us-west-2 ca-central-1 eu-west-1 eu-west-2 eu-west-3 eu-central-1 ap-south-1 ap-southeast-1 ap-southeast-2 ap-northeast-1 ap-northeast-2 sa-east-1 Select region [any region, credential is not region specific]: Using auth-type "access-key". Enter access-key: 7efgugfygr Enter secret-key: Credential "sample" added locally for cloud "aws". ``` (*) Add credential with file (local since no current nor specified controller) ``` $ juju add-credential aws -f ~/creds.yaml WARNING credential "sample" for cloud "aws" already exists locally, use 'juju update-credential aws sample' to update it No local credentials for cloud "aws" changed. $ juju add-credential aws -f ~/creds.yaml Credentials "example" added locally for cloud "aws". ``` (*) Add credential to a specified controller with file ``` $ juju add-credential aws -f ~/creds.yaml -c mycontroller Using remote cloud "aws" from the controller to verify credentials. Credential "special" added locally for cloud "aws". Controller credential "special" for user "admin" for cloud "aws" on controller "mycontroller" added. For more information, see ‘juju show-credential aws special’. ``` (*) Add credential to a current controller with file (prompt) ``` $ juju add-credential aws -f ~/creds.yaml Do you want to add a credential to current controller "mycontroller"? (Y/n): Using remote cloud "aws" from the controller to verify credentials. Credential "news" added locally for cloud "aws". Controller credential "news" for user "admin" for cloud "aws" on controller "mycontroller" added. For more information, see ‘juju show-credential aws news’. ``` (*) Add credential to a current controller with file (skip prompt) ``` $ juju add-credential aws -f ~/creds.yaml --no-prompt Using remote cloud "aws" from the controller to verify credentials. Credential "again" added locally for cloud "aws". Controller credential "again" for user "admin" for cloud "aws" on controller "mycontroller" added. For more information, see ‘juju show-credential aws again’. ``` (*) Add credential (remote since credential exists locally) ``` $ juju add-credential aws -f ~/creds.yaml -c mycontroller Using remote cloud "aws" from the controller to verify credentials. WARNING credential "trial" for cloud "aws" already exists locally, use 'juju update-credential aws trial' to update it No local credentials for cloud "aws" changed. Controller credential "trial" for user "admin" for cloud "aws" on controller "mycontroller" added. For more information, see ‘juju show-credential aws trial’. ``` (*) Add credential to a specified controller interactively ``` $ juju add-credential aws -c mycontroller Using remote cloud "aws" from the controller to verify credentials. Enter credential name: okay Regions ap-northeast-1 ap-northeast-2 ap-south-1 ap-southeast-1 ap-southeast-2 ca-central-1 eu-central-1 eu-west-1 eu-west-2 eu-west-3 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2 Select region [any region, credential is not region specific]: Using auth-type "access-key". Enter access-key: dscsc Enter secret-key: Credential "okay" added locally for cloud "aws". Controller credential "okay" for user "admin" for cloud "aws" on controller "mycontroller" added. For more information, see ‘juju show-credential aws okay’. ``` (*) Add credential to a current controller interactively (prompt) ``` $ juju add-credential aws Do you want to add a credential to current controller "mycontroller"? (Y/n): Using remote cloud "aws" from the controller to verify credentials. Enter credential name: fuunny Regions ap-northeast-1 ap-northeast-2 ap-south-1 ap-southeast-1 ap-southeast-2 ca-central-1 eu-central-1 eu-west-1 eu-west-2 eu-west-3 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2 Select region [any region, credential is not region specific]: Using auth-type "access-key". Enter access-key: asdsds Enter secret-key: Credential "fuunny" added locally for cloud "aws". Controller credential "fuunny" for user "admin" for cloud "aws" on controller "mycontroller" added. For more information, see ‘juju show-credential aws fuunny’. ``` (*) Add credential to a current controller interactively (skip prompt) ``` $ juju add-credential aws --no-prompt Using remote cloud "aws" from the controller to verify credentials. Enter credential name: buteme Regions ap-northeast-1 ap-northeast-2 ap-south-1 ap-southeast-1 ap-southeast-2 ca-central-1 eu-central-1 eu-west-1 eu-west-2 eu-west-3 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2 Select region [any region, credential is not region specific]: Using auth-type "access-key". Enter access-key: dfcdv Enter secret-key: Credential "buteme" added locally for cloud "aws". Controller credential "buteme" for user "admin" for cloud "aws" on controller "mycontroller" added. For more information, see ‘juju show-credential aws buteme’. ``` (*) Add credential exists both locally and remotely ``` $ juju add-credential aws -f ~/creds.yaml -c mycontroller Using remote cloud "aws" from the controller to verify credentials. WARNING credential "amtest" for cloud "aws" already exists locally, use 'juju update-credential aws amtest' to update it No local credentials for cloud "aws" changed. No remote credentials for cloud "aws" added. ```
- Loading branch information