papi: support old style of providing apidir 31/40231/2
authorVratko Polak <vrpolak@cisco.com>
Mon, 22 Jan 2024 13:56:02 +0000 (14:56 +0100)
committerOle Tr�an <otroan@employees.org>
Tue, 23 Jan 2024 16:34:14 +0000 (16:34 +0000)
77caeb1b193404e76beb27a1aa81321e8eb1cf1f has changed the behavior
in an incompatible way, breaking users (including CSIT).

The new behavior is more pythonic,
but the old behavior has to be supported
at least one release after publicly deprecating it.

Type: fix

Change-Id: I9dfdd2229065010216e49db80b14b856c545965c
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
src/vpp-api/python/vpp_papi/vpp_papi.py

index 5c08964..5a9e0a7 100644 (file)
@@ -473,9 +473,12 @@ class VPPApiClient:
         self._apifiles = apifiles
         self.stats = {}
 
+        if self.apidir is None and hasattr(self.__class__, "apidir"):
+            # Keep supporting the old style of providing apidir.
+            self.apidir = self.__class__.apidir
         try:
             self.apifiles, self.messages, self.services = VPPApiJSONFiles.load_api(
-                apifiles, apidir
+                apifiles, self.apidir
             )
         except VPPRuntimeError as e:
             if testmode: