diff options
author | Joshua Harlow <harlowja@gmail.com> | 2014-11-30 21:29:29 -0800 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2014-11-30 21:29:29 -0800 |
commit | 6e3e3a9a3adb3ba00154fd0a4d1cd179fd7ea56d (patch) | |
tree | 807f7d857658b954c287a4753ef54a13662dacab /cloudinit/netinfo.py | |
parent | 411c6457222f9b33d2fa272dc61fb0c56e3a8be3 (diff) | |
download | vyos-cloud-init-6e3e3a9a3adb3ba00154fd0a4d1cd179fd7ea56d.tar.gz vyos-cloud-init-6e3e3a9a3adb3ba00154fd0a4d1cd179fd7ea56d.zip |
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.
Diffstat (limited to 'cloudinit/netinfo.py')
-rw-r--r-- | cloudinit/netinfo.py | 8 |
1 files 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 |