- Add cloud-init-translate-netconf-ipv4-keep-gw.patch (bsc#1064854)

+ Properly insert the gateway information for v1 json network config data

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=94
This commit is contained in:
Robert Schweikert 2017-11-16 22:51:16 +00:00 committed by Git OBS Bridge
parent e03ed2d736
commit 56e2c9145a
3 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,46 @@
--- cloudinit/distros/net_util.py.orig
+++ cloudinit/distros/net_util.py
@@ -67,6 +67,10 @@
# }
# }
+import re
+
+ipv4 = re.compile("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}")
+
def translate_network(settings):
# Get the standard cmd, args from the ubuntu format
entries = []
@@ -88,7 +92,14 @@ def translate_network(settings):
consume = {}
consume[cmd] = args
else:
- consume[cmd] = args
+ if consume.get(cmd):
+ val = consume[cmd]
+ if isinstance(val, list):
+ consume[cmd].append(args)
+ else:
+ consume[cmd] = [val, args]
+ else:
+ consume[cmd] = args
# Check if anything left over to consume
absorb = False
for (cmd, args) in consume.items():
@@ -148,6 +159,16 @@ def translate_network(settings):
hw_addr = hw_split[1]
if hw_addr:
iface_info['hwaddress'] = hw_addr
+ if 'post-up' in info:
+ routes = info['post-up']
+ if isinstance(routes, list):
+ for route_info in routes:
+ if 'default gw' in route_info:
+ iface_info['gateway'] = ipv4.search(
+ route_info).group(0)
+ elif 'default gw' in route_info:
+ iface_info['gateway'] = ipv4.search(route_info).group(0)
+
# If ipv6 is enabled, device will have multiple IPs, so we need to
# update the dictionary instead of overwriting it...
if dev_name in real_ifaces:

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Nov 16 22:48:40 UTC 2017 - rjschwei@suse.com
- Add cloud-init-translate-netconf-ipv4-keep-gw.patch (bsc#1064854)
+ Properly insert the gateway information for v1 json network config data
-------------------------------------------------------------------
Sat Nov 11 12:32:54 UTC 2017 - rjschwei@suse.com

View File

@ -33,6 +33,8 @@ Patch5: zypp_add_repo_test.patch
Patch6: cloud-init-hosts-template.patch
# FIXME cloud-init-ntp-conf-suse.patch proposed for upstream merge (lp#1726572)
Patch7: cloud-init-ntp-conf-suse.patch
# Patch 8 cloud-init-translate-netconf-ipv4-keep-gw (bsc#1064854)
Patch8: cloud-init-translate-netconf-ipv4-keep-gw.patch
Patch10: cloud-init-no-user-lock-if-already-locked.patch
Patch12: fix-default-systemd-unit-dir.patch
# Remove Patch 13 for next source updated, included upstream
@ -195,6 +197,8 @@ Documentation and examples for cloud-init tools
%patch4 -p0
%patch5 -p0
%patch6
%patch7
%patch8
%patch10 -p1
%patch12
%patch13