From 75d81fd342ef73115ddfeed4e595042a0cb08bb9 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 11 Nov 2020 13:49:37 +0100 Subject: [PATCH] Do not fail if routes are missing from a network Routes are optional in the schema, let's not treat them as required. Change-Id: Id3130634fa61ff2e3bd7483ba4b5452dca4de909 --- glean/cmd.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glean/cmd.py b/glean/cmd.py index a577ed5..65e348d 100644 --- a/glean/cmd.py +++ b/glean/cmd.py @@ -202,7 +202,7 @@ def _write_rh_interface(name, interface, args): # the return value, not append it results = _set_rh_bonding(name, interface, distro, results) routes = [] - for route in interface['routes']: + for route in interface.get('routes', ()): if route['network'] == '0.0.0.0' and route['netmask'] == '0.0.0.0': if not _is_suse(distro): results += "DEFROUTE=yes\n" @@ -657,7 +657,7 @@ mac_{name}="{hwaddr}\"\n""".format( hwaddr=interface['mac_address'] ) routes = list() - for route in interface['routes']: + for route in interface.get('routes', ()): if (route['network'] == '0.0.0.0' and route['netmask'] == '0.0.0.0'): # add default route if it exists @@ -890,7 +890,7 @@ def write_debian_interfaces(interfaces, sys_interfaces): result += " netmask {0}\n".format( utils.ipv6_netmask_length(interface['netmask'])) - for route in interface['routes']: + for route in interface.get('routes', ()): if ((route['network'] == '0.0.0.0' and route['netmask'] == '0.0.0.0') or (route['network'] == '::' and