API options: Fix case when no options are present 40/31640/2
authorVratko Polak <vrpolak@cisco.com>
Mon, 15 Mar 2021 09:02:45 +0000 (10:02 +0100)
committerDave Wallace <dwallacelf@gmail.com>
Tue, 16 Mar 2021 00:46:49 +0000 (00:46 +0000)
In that case we want to pass by returning an empty dict,
as docstring already describes.
Before this, the code failed when checking for included version.

Change-Id: Ia0d6b81a64ad0e7027ac7daf15c72ace1f6982ce
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
resources/libraries/python/VppApiCrc.py

index 94e2690..1fcb91d 100644 (file)
@@ -197,8 +197,8 @@ class VppApiCrcChecker:
         for item in reversed(msg_obj):
             if not isinstance(item, dict):
                 continue
-            options = item.get(u"options", None)
-            if options is not None:
+            options = item.get(u"options", dict())
+            if not options:
                 break
         if version is None or version.startswith(u"0."):
             options[u"version"] = version

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.