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
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.