network-get format yaml keys differ from format json

Bug #1915418 reported by Drew Freiberger
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Joseph Phillips

Bug Description

I've found while investigating lp#1897261 that there's a different key path for address data between yaml and json outputs of network-get.

Note the path in json to 10.0.8.140 is: data[bind-addresses][0][addresses][0][value]
But the path in yaml to the same element is: data[bind-addresses][0][addresses][0][address]

Since charmhelpers uses the yaml format for network_get abstraction, charms should use the second path with key name "address", but anyone wanting to parse the json will find they need to use the "value" key name.

ubuntu@juju-22b3c3-0:~$ sudo juju-run designate/0 "network-get juju-info --format json"|jq .
{
  "bind-addresses": [
    {
      "mac-address": "00:16:3e:7e:85:b6",
      "interface-name": "eth0",
      "addresses": [
        {
          "hostname": "",
          "value": "10.0.8.140",
          "cidr": "10.0.8.0/24"
        }
      ]
    }
  ],
  "egress-subnets": [
    "10.0.8.140/32"
  ],
  "ingress-addresses": [
    "10.0.8.140"
  ]
}
ubuntu@juju-22b3c3-0:~$ sudo juju-run designate/0 "network-get juju-info --format yaml"
bind-addresses:
- macaddress: 00:16:3e:7e:85:b6
  interfacename: eth0
  addresses:
  - hostname: ""
    address: 10.0.8.140
    cidr: 10.0.8.0/24
egress-subnets:
- 10.0.8.140/32
ingress-addresses:
- 10.0.8.140

Ian Booth (wallyworld)
Changed in juju:
milestone: none → 2.9-rc7
importance: Undecided → High
status: New → Triaged
Changed in juju:
milestone: 2.9-rc7 → 2.9-rc8
Changed in juju:
assignee: nobody → Joseph Phillips (manadart)
Changed in juju:
milestone: 2.9-rc8 → 2.9-rc9
Changed in juju:
status: Triaged → In Progress
Changed in juju:
milestone: 2.9-rc9 → 2.9-rc10
Revision history for this message
Joseph Phillips (manadart) wrote :

https://github.com/juju/juju/pull/12853

See the patch description. Juju 2.9 *adds* fields to match the JSON, but we keep the old ones so as not to break old agents.

Juju 3 will remove the old fields.

Changed in juju:
status: In Progress → Fix Committed
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.