"juju credentials" commands return different dictionaries for json and yaml output

Bug #1643968 reported by Francis Ginther
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Expired
Medium
Unassigned

Bug Description

This was seen with 2.0.1-xenial-amd64 and a bootstrapped maas cluster (although I don't know if this command actually requires a bootstrapped node):

ubuntu@landscape-xenial:~$ juju credentials --show-secrets scapestack --format yaml
credentials:
  scapestack:
    scapestack:
      auth-type: oauth1
      maas-oauth: [REDACTED]

ubuntu@landscape-xenial:~$ juju credentials --show-secrets scapestack --format json
{"credentials":{"scapestack":{"cloud-credentials":{"scapestack":{"auth-type":"oauth1","details":{"maas-oauth":"[REDACTED]"}}}}}}

Also available via: https://pastebin.canonical.com/171459/

The json version adds an extra layer, "cloud-credentials", that isn't in the yaml.

Expectation is that command would return the exact same data regardless of formatting in yaml or json.

Revision history for this message
Francis Ginther (fginther) wrote :

Also seen with juju version 2.1-beta1-xenial-amd64.

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

There is also another extra layer in json format, "details, that isn't in the yaml.

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

So looking further at it, there is not much that we can do on Juju side. The problem seems to be on Json parser side - there is no json directive to say "print the contents of the map but not its name". We can do it in yaml but not in json.

So if we want to be consistent between yaml and json format, we can add the names of the maps to yaml output. So your example above would read:

$ juju credentials --show-secrets scapestack --format yaml
credentials:
  scapestack:
    cloud-credentials:
      scapestack:
        auth-type: oauth1
        details:
          maas-oauth: [REDACTED]

Changed in juju:
status: In Progress → Triaged
assignee: Anastasia (anastasia-macmood) → nobody
Changed in juju:
status: Triaged → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for juju because there has been no activity for 60 days.]

Changed in juju:
status: Incomplete → Expired
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.