diff options
author | Andreas Karis <akaris@redhat.com> | 2017-06-06 12:55:50 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-06-07 17:55:00 -0400 |
commit | f99745cf916e707eaa1ded6f12e8b69837b7242d (patch) | |
tree | 9e7a7a3c5ae1ff2774ec65771aca640ae9dda7ee /cloudinit | |
parent | 8d58f12248c0bd9e8f88296f29935fd3dc33b415 (diff) | |
download | vyos-cloud-init-f99745cf916e707eaa1ded6f12e8b69837b7242d.tar.gz vyos-cloud-init-f99745cf916e707eaa1ded6f12e8b69837b7242d.zip |
RHEL/CentOS: Fix default routes for IPv4/IPv6 configuration.
Since f38fa413176, default routes get added to both ifcfg-* and route-*
and route6-* files. Default routes should only go to ifcfg-* files,
otherwise the information is redundant.
LP: #1696176
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/net/sysconfig.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py index 58c5713f..f7d45482 100644 --- a/cloudinit/net/sysconfig.py +++ b/cloudinit/net/sysconfig.py @@ -372,11 +372,13 @@ class Renderer(renderer.Renderer): nm_key = 'NETMASK%s' % route_cfg.last_idx addr_key = 'ADDRESS%s' % route_cfg.last_idx route_cfg.last_idx += 1 - for (old_key, new_key) in [('gateway', gw_key), - ('netmask', nm_key), - ('network', addr_key)]: - if old_key in route: - route_cfg[new_key] = route[old_key] + # add default routes only to ifcfg files, not + # to route-* or route6-* + for (old_key, new_key) in [('gateway', gw_key), + ('netmask', nm_key), + ('network', addr_key)]: + if old_key in route: + route_cfg[new_key] = route[old_key] @classmethod def _render_bonding_opts(cls, iface_cfg, iface): |