[2.7] add-cloud and add-credential return types should be more consistent

Bug #1851441 reported by Joshua Genet
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Low
Anastasia

Bug Description

When adding a cloud, if it already exists, juju returns ERROR.
When adding a credential, if it already exists, juju returns WARNING.

These should either both be ERRORs or both be WARNINGs.
The output could be a bit more unified as well.

ubuntu@vsphere$ juju add-cloud vsphere cloud.yaml --client
ERROR use `update-cloud vsphere --client` to override known definition: local cloud "vsphere" already exists
ubuntu@vsphere$ echo $?
1

ubuntu@vsphere$ juju add-credential vsphere -f credentials.yaml --client
WARNING credential "steve" for cloud "vsphere" already exists locally, use 'juju update-credential vsphere steve -f credentials.yaml' to update this local client copy
No local credentials for cloud "vsphere" changed.
ubuntu@vsphere$ echo $?
0

ubuntu@vsphere$ juju version
2.7-rc1-bionic-amd64

Changed in juju:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Anastasia (anastasia-macmood)
status: Triaged → In Progress
Revision history for this message
Anastasia (anastasia-macmood) wrote :

There are subtle differences between 'add-cloud' and 'add-credential' commands. The most predominant one is that 'add-credential' command supports adding several credentials at once whereas 'add-cloud' can only add one cloud at a time.

For that reason 'add credential' was showing WARNING instead of ERROR to ensure that the processing of potentially other credentials can continue.

It's true that it is surprising to a user since something that was asked did not happen. So, Juju should really err out in this instance.

I have proposed a PR that fixes this and other similar occurrences in cloud/credential commands: https://github.com/juju/juju/pull/10864

Changed in juju:
status: In Progress → Fix Committed
milestone: none → 2.7.0
Changed in juju:
milestone: 2.7.0 → 2.7-rc2
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.