← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~hyask/autopkgtest-cloud:skia/really_clean_workdir into autopkgtest-cloud:master

 

Skia has proposed merging ~hyask/autopkgtest-cloud:skia/really_clean_workdir into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/463993

Fix the cleaning of working directories in `/tmp`
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~hyask/autopkgtest-cloud:skia/really_clean_workdir into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
index 24d0367..17906e3 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -419,7 +419,7 @@ def process_output_dir(
         for f in files:
             path = os.path.join(dir, f)
             if os.path.isdir(path):
-                shutil.rmtree(path)
+                shutil.rmtree(path, ignore_errors=True)
             else:
                 os.unlink(path)
 
@@ -605,7 +605,7 @@ def log_contents(out_dir):
 
 def cleanup_and_sleep(out_dir):
     """Empty the output dir for the next run, otherwise autopkgtest complains"""
-    shutil.rmtree(out_dir)
+    shutil.rmtree(out_dir, ignore_errors=True)
     os.mkdir(out_dir)
     time.sleep(300)
 
@@ -1399,7 +1399,7 @@ def request(msg):
 
         swift_con.close()
     finally:
-        shutil.rmtree(work_dir)
+        shutil.rmtree(work_dir, ignore_errors=True)
 
     global amqp_con
     complete_amqp = amqp_con.channel()