Fix version test in CI 42/116942/1
authormrichomme <morgan.richomme@orange.com>
Mon, 18 Jan 2021 09:08:30 +0000 (10:08 +0100)
committermrichomme <morgan.richomme@orange.com>
Mon, 18 Jan 2021 09:08:30 +0000 (10:08 +0100)
Issue-ID: INT-1834

Signed-off-by: mrichomme <morgan.richomme@orange.com>
Change-Id: I032ad1234036c5671722456995d1059a8a493cfb

test/security/check_versions/src/k8s_bin_versions_inspector.py

index e5a59b9..d576dd7 100644 (file)
@@ -305,13 +305,17 @@ def sync_post_namespaced_pod_exec(
 
     # TODO: Is there really no better way, to check
     # execution exit code in python k8s API client?
-    code = (
-        0
-        if error["status"] == "Success"
-        else -2
-        if error["reason"] != "NonZeroExitCode"
-        else int(error["details"]["causes"][0]["message"])
-    )
+    code=-2
+    try:
+        code = (
+            0
+            if error["status"] == "Success"
+            else -2
+            if error["reason"] != "NonZeroExitCode"
+            else int(error["details"]["causes"][0]["message"])
+        )
+    except:
+        pass
 
     return {
         "stdout": stdout,