diff --git a/cloud-init-translate-netconf-ipv4-keep-gw.patch b/cloud-init-translate-netconf-ipv4-keep-gw.patch new file mode 100644 index 0000000..6e68a20 --- /dev/null +++ b/cloud-init-translate-netconf-ipv4-keep-gw.patch @@ -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: diff --git a/cloud-init.changes b/cloud-init.changes index d64e924..451f9b3 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -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 diff --git a/cloud-init.spec b/cloud-init.spec index 91b0f00..2295181 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -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