Andreas Karis has proposed merging ~akaris/cloud-init:bug1696176 into cloud-init:master.
Commit message: RHEL/CentOS: Fix default routes for IPv4/IPv6 configuration Since f38fa41317602908139aa96e930b634f65e39555 , 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 Requested reviews: cloud-init commiters (cloud-init-dev) Server Team CI bot (server-team-bot): continuous-integration Related bugs: Bug #1696176 in cloud-init: "Add default routes for IPv4 and IPv6 only to ifcfg-* files and not to route-* or route6-* files in sysconfig" https://bugs.launchpad.net/cloud-init/+bug/1696176 For more details, see: https://code.launchpad.net/~akaris/cloud-init/+git/cloud-init/+merge/325186 -- Your team cloud-init commiters is requested to review the proposed merge of ~akaris/cloud-init:bug1696176 into cloud-init:master.
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py index 58c5713..f7d4548 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): diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py index 0000b07..0a88caf 100644 --- a/tests/unittests/test_net.py +++ b/tests/unittests/test_net.py @@ -150,14 +150,6 @@ ONBOOT=yes TYPE=Ethernet USERCTL=no """.lstrip()), - ('etc/sysconfig/network-scripts/route-eth0', - """ -# Created by cloud-init on instance boot automatically, do not edit. -# -ADDRESS0=0.0.0.0 -GATEWAY0=172.19.3.254 -NETMASK0=0.0.0.0 -""".lstrip()), ('etc/resolv.conf', """ ; Created by cloud-init on instance boot automatically, do not edit.
_______________________________________________ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp