check_certificates: create result dir if needed 30/112030/4
authormrichomme <morgan.richomme@orange.com>
Wed, 2 Sep 2020 08:03:47 +0000 (10:03 +0200)
committermrichomme <morgan.richomme@orange.com>
Wed, 2 Sep 2020 12:39:30 +0000 (14:39 +0200)
an arg allows to specify the results dir
but if the dir path is not valid, we got an error
try to create the dir before running the test

Issue-ID: INT-1570

Signed-off-by: mrichomme <morgan.richomme@orange.com>
Change-Id: I32363af1f066dc5e5a0adf45619fb4e1a9052a7d
Signed-off-by: mrichomme <morgan.richomme@orange.com>
test/security/check_certificates/check_certificates/check_certificates_validity.py

index c38a7dc..7447a64 100644 (file)
@@ -89,6 +89,10 @@ args = parser.parse_args()
 onap_namespace = args.namespace
 LOGGER.info("Verification of the %s certificates started", onap_namespace)
 
+# Create the target dir (in case it does not exist)
+if os.pardir not in args.dir:
+    os.makedirs(args.dir, exist_ok=True)
+
 # Nodeport specific section
 # Retrieve the kubernetes IP for mode nodeport
 if args.mode == "nodeport":