Error printed when adding a model with a faulty credential can be improved

Bug #1821482 reported by Peter Matulis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
Unassigned

Bug Description

I attempted to add a model with an invalid credential:

$ juju add-model --credential mithrandir rivendell

Output:

Uploading credential 'google/pete/mithrandir' to controller
ERROR failed to create environ: Get https://www.googleapis.com/compute/v1/projects/juju-gce-1325?alt=json: private key should be a PEM or plain PKSC1 or PKCS8; parse error: asn1: structure error: tags don't match
 (2 vs {class:0 tag:16 length:13 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} @5

===

This error should be caught and the user presented with something more meaningful and tender.

Suggestion:

The model could not be created as credential 'mithrandir' is invalid.

===

Note that if the "Uploading credential..." part gets printed we may want to assure the user that a bad credential has not ended up on the controller. I suggest suppressing that message until the credential has been successfully validated.

Revision history for this message
Anastasia (anastasia-macmood) wrote :

Great idea! Thank you for suggestion, Peter!

Changed in juju:
status: New → Triaged
importance: Undecided → Medium
tags: added: credentials
tags: added: usability
Revision history for this message
Anastasia (anastasia-macmood) wrote :

Since this bug was filed, the scenario has been addressed by other work in the area.
On Juju 2.7-b1, I get:

$ juju add-model --credential mithrandir rivendell
ERROR credential 'mithrandir' not found

which is consistent with comparable output in other places: it's not that this credential is not valid, it is that we cannot find it.

Changed in juju:
status: Triaged → Fix Committed
milestone: none → 2.7-beta1
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.