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:
@@ -410,6 +410,11 @@ class networkInterfaces():
|
|||||||
fp = open(filename)
|
fp = open(filename)
|
||||||
ifacedicts = json.load(fp)
|
ifacedicts = json.load(fp)
|
||||||
#object_hook=ifaceJsonDecoder.json_object_hook)
|
#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:
|
for ifacedict in ifacedicts:
|
||||||
ifaceobj = ifaceJsonDecoder.json_to_ifaceobj(ifacedict)
|
ifaceobj = ifaceJsonDecoder.json_to_ifaceobj(ifacedict)
|
||||||
if ifaceobj:
|
if ifaceobj:
|
||||||
|
Reference in New Issue
Block a user