summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2017-06-09 12:35:11 -0500
committerScott Moser <smoser@brickies.net>2017-07-18 17:04:59 -0400
commitd1e8eb73aca6a3f5cee415774dcf540e934ec250 (patch)
tree93fb353a830d3d27d8114052a8acb8f7d4bf0c84 /cloudinit/net
parente80517ae6aea49c9ab3bd622a33fee44014f485f (diff)
downloadvyos-cloud-init-d1e8eb73aca6a3f5cee415774dcf540e934ec250.tar.gz
vyos-cloud-init-d1e8eb73aca6a3f5cee415774dcf540e934ec250.zip
sysconfig: include GATEWAY value if set in subnet
Render the GATEWAY= value in interface files which have a gateway in the subnet configuration. LP: #1686856
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/sysconfig.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index 7ed11d1e..ad8c268e 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -329,6 +329,9 @@ class Renderer(renderer.Renderer):
iface_cfg['NETMASK' + suff] = \
net_prefix_to_ipv4_mask(subnet['prefix'])
+ if 'gateway' in subnet:
+ iface_cfg['GATEWAY'] = subnet['gateway']
+
@classmethod
def _render_subnet_routes(cls, iface_cfg, route_cfg, subnets):
for i, subnet in enumerate(subnets, start=len(iface_cfg.children)):