Antoni Segura Puimedon has uploaded a new change for review. Change subject: netinfo: fix defaultdict regression ......................................................................
netinfo: fix defaultdict regression netinfo.get is supposed to retun a map containing the keys: - bondings - bridges - networks - nics - vlans The change http://gerrit.ovirt.org/#/c/21652/5/lib/vdsm/netinfo.py replaced the dictionary initialization to 'networks': {} (and assignment of the other keys to a dict that could be empty) with a defaultdict. Unfortunately since not always are there gonna be elements for each of the keys that get() is supposed to return, get() could end up reporting only 'nics', creating all sorts of havoc in caps.py and any get() consumer. (It failed the unit tests on machines without vdsm networks defined). Change-Id: I5c59eea34f7ad7f28428292f064698d1d04cbdb5 Signed-off-by: Antoni S. Puimedon <asegu...@redhat.com> --- M lib/vdsm/netinfo.py 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/21850/1 diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py index da01905..edc1c13 100644 --- a/lib/vdsm/netinfo.py +++ b/lib/vdsm/netinfo.py @@ -18,7 +18,7 @@ # Refer to the README and COPYING files for full details of the license # -from collections import namedtuple, defaultdict +from collections import namedtuple import errno from glob import iglob from itertools import chain @@ -528,7 +528,8 @@ def get(): - d = defaultdict(dict) + d = {'bondings': {}, 'bridges': {}, 'networks': {}, 'nics': {}, + 'vlans': {}} gateways = getRoutes() ipv6routes = getIPv6Routes() paddr = permAddr() -- To view, visit http://gerrit.ovirt.org/21850 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5c59eea34f7ad7f28428292f064698d1d04cbdb5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <asegu...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches