Merge ~akaris/cloud-init:bug1696176 into cloud-init:master

Proposed by Andreas Karis
Status: Rejected
Rejected by: Scott Moser
Proposed branch: ~akaris/cloud-init:bug1696176
Merge into: cloud-init:master
Diff against target: 42 lines (+7/-13)
2 files modified
cloudinit/net/sysconfig.py (+7/-5)
tests/unittests/test_net.py (+0/-8)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
cloud-init Commiters Pending
Review via email: mp+325174@code.launchpad.net

This proposal has been superseded by a proposal from 2017-06-06.

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

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Unmerged commits

edad166... by Andreas Karis

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
2index 58c5713..f7d4548 100644
3--- a/cloudinit/net/sysconfig.py
4+++ b/cloudinit/net/sysconfig.py
5@@ -372,11 +372,13 @@ class Renderer(renderer.Renderer):
6 nm_key = 'NETMASK%s' % route_cfg.last_idx
7 addr_key = 'ADDRESS%s' % route_cfg.last_idx
8 route_cfg.last_idx += 1
9- for (old_key, new_key) in [('gateway', gw_key),
10- ('netmask', nm_key),
11- ('network', addr_key)]:
12- if old_key in route:
13- route_cfg[new_key] = route[old_key]
14+ # add default routes only to ifcfg files, not
15+ # to route-* or route6-*
16+ for (old_key, new_key) in [('gateway', gw_key),
17+ ('netmask', nm_key),
18+ ('network', addr_key)]:
19+ if old_key in route:
20+ route_cfg[new_key] = route[old_key]
21
22 @classmethod
23 def _render_bonding_opts(cls, iface_cfg, iface):
24diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
25index 0000b07..0a88caf 100644
26--- a/tests/unittests/test_net.py
27+++ b/tests/unittests/test_net.py
28@@ -150,14 +150,6 @@ ONBOOT=yes
29 TYPE=Ethernet
30 USERCTL=no
31 """.lstrip()),
32- ('etc/sysconfig/network-scripts/route-eth0',
33- """
34-# Created by cloud-init on instance boot automatically, do not edit.
35-#
36-ADDRESS0=0.0.0.0
37-GATEWAY0=172.19.3.254
38-NETMASK0=0.0.0.0
39-""".lstrip()),
40 ('etc/resolv.conf',
41 """
42 ; Created by cloud-init on instance boot automatically, do not edit.

Subscribers

People subscribed via source and target branches