1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

ifupdown2 must handle JSON input that is non-list

Ticket: CM-4417
Reviewed By: roopa
Testing Done: Build powerpc image and tested alternate json format

ifupdown2 was patched to handle nonlist JSON input since this
is a valid format.
(cherry picked from commit 2597194f6f34344495f3a2b44bfe1d05887e1e77)
This commit is contained in:
Sam Tannous
2015-02-11 11:37:41 -05:00
parent 496745cdc0
commit b6c1f5513a

View File

@@ -410,6 +410,11 @@ class networkInterfaces():
fp = open(filename)
ifacedicts = json.load(fp)
#object_hook=ifaceJsonDecoder.json_object_hook)
# we need to handle both lists and non lists formats (e.g. {{}})
if not isinstance(ifacedicts,list):
ifacedicts = [ifacedicts]
for ifacedict in ifacedicts:
ifaceobj = ifaceJsonDecoder.json_to_ifaceobj(ifacedict)
if ifaceobj: