diff options
author | Scott Moser <smoser@brickies.net> | 2017-05-24 21:10:50 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-06-08 18:34:06 -0400 |
commit | d00da2d5b0d45db5670622a66d833d2abb907388 (patch) | |
tree | ad084f88eb4de4c448959e4f3f8543550259a441 /cloudinit/net/eni.py | |
parent | 76d58265e34851b78e952a7f275340863c90a9f5 (diff) | |
download | vyos-cloud-init-d00da2d5b0d45db5670622a66d833d2abb907388.tar.gz vyos-cloud-init-d00da2d5b0d45db5670622a66d833d2abb907388.zip |
net: normalize data in network_state object
The network_state object's network and route keys would have different
information depending upon how the network_state object was populated.
This change cleans that up. Now:
* address will always contain an IP address.
* prefix will always include an integer value that is the
network_prefix for the address.
* netmask will be present only if the address is ipv4, and its
value will always correlate to the 'prefix'.
Diffstat (limited to 'cloudinit/net/eni.py')
-rw-r--r-- | cloudinit/net/eni.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py index 20e19f5b..98ce01e4 100644 --- a/cloudinit/net/eni.py +++ b/cloudinit/net/eni.py @@ -46,6 +46,10 @@ def _iface_add_subnet(iface, subnet): 'dns_nameservers', ] for key, value in subnet.items(): + if key == 'netmask': + continue + if key == 'address': + value = "%s/%s" % (subnet['address'], subnet['prefix']) if value and key in valid_map: if type(value) == list: value = " ".join(value) |