run_upload_packages.py should make sure the directory it tries to put a
authorWard Vandewege <ward@curii.com>
Thu, 28 Jan 2021 22:30:55 +0000 (17:30 -0500)
committerWard Vandewege <ward@curii.com>
Thu, 28 Jan 2021 22:30:55 +0000 (17:30 -0500)
timestamp file in exists.

No issue #

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

jenkins/run_upload_packages.py

index 0840f2fc560a64b4d4708389d33b512cf80f94f1..8a31d2e383bc20ba1c71d76c397dae9a9b64fc11 100755 (executable)
@@ -5,6 +5,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 import argparse
+import errno
 import functools
 import glob
 import locale
@@ -50,6 +51,15 @@ def run_and_grep(cmd, read_output, *regexps,
 class TimestampFile:
     def __init__(self, path):
         self.path = path
+        # Make sure the dirname for `path` exists
+        p = os.path.dirname(path)
+        try:
+            os.makedirs(p)
+        except OSError as exc:
+            if exc.errno == errno.EEXIST and os.path.isdir(path):
+                pass
+            else:
+                raise
         self.start_time = time.time()
 
     def last_upload(self):