Blob Blame History Raw
From 6f9c05464a8ed420fb3e2ed71b401ecd1d772bad Mon Sep 17 00:00:00 2001
From: Ryan McCabe <rmccabe@redhat.com>
Date: Tue, 30 Jan 2018 12:37:00 -0500
Subject: [PATCH 2/3] Render the GATEWAY= value in interface files which have a
 gateway in the subnet configuration.

Resolves: rhbz#1540094
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
---
 cloudinit/net/sysconfig.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index 25c29104..ca031691 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -347,6 +347,9 @@ class Renderer(renderer.Renderer):
                             iface_cfg['NETMASK' + str(ipv4_index)] = \
                                 subnet['netmask']
 
+                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)):
-- 
2.14.3