From 6e3e3a9a3adb3ba00154fd0a4d1cd179fd7ea56d Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sun, 30 Nov 2014 21:29:29 -0800 Subject: Fix the getgateway function After the routeinfo function started to return a dictionary containing ipv4 and ipv6 information we now need to make sure we search the appropriate key. --- cloudinit/netinfo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloudinit/netinfo.py b/cloudinit/netinfo.py index 473b5fd6..3de50a19 100644 --- a/cloudinit/netinfo.py +++ b/cloudinit/netinfo.py @@ -166,14 +166,14 @@ def route_info(): def getgateway(): - routes = [] try: routes = route_info() except: pass - for r in routes: - if r['flags'].find("G") >= 0: - return "%s[%s]" % (r['gateway'], r['iface']) + else: + for r in routes.get('ipv4', []): + if r['flags'].find("G") >= 0: + return "%s[%s]" % (r['gateway'], r['iface']) return None -- cgit v1.2.3