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

Proposed by Skia
Status: Merged
Merged at revision: a5f2474651f671a9c5d9226c1eb0361061209e03
Proposed branch: ~hyask/autopkgtest-cloud:skia/really_clean_workdir
Merge into: autopkgtest-cloud:master
Diff against target: 31 lines (+3/-3)
1 file modified
charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker (+3/-3)
Reviewer Review Type Date Requested Status
Tim Andersson Approve
Review via email: mp+463993@code.launchpad.net

Description of the change

Fix the cleaning of working directories in `/tmp`

To post a comment you must log in.
Revision history for this message
Tim Andersson (andersson123) wrote :

LGTM, nice

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
2index 24d0367..17906e3 100755
3--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
4+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
5@@ -419,7 +419,7 @@ def process_output_dir(
6 for f in files:
7 path = os.path.join(dir, f)
8 if os.path.isdir(path):
9- shutil.rmtree(path)
10+ shutil.rmtree(path, ignore_errors=True)
11 else:
12 os.unlink(path)
13
14@@ -605,7 +605,7 @@ def log_contents(out_dir):
15
16 def cleanup_and_sleep(out_dir):
17 """Empty the output dir for the next run, otherwise autopkgtest complains"""
18- shutil.rmtree(out_dir)
19+ shutil.rmtree(out_dir, ignore_errors=True)
20 os.mkdir(out_dir)
21 time.sleep(300)
22
23@@ -1399,7 +1399,7 @@ def request(msg):
24
25 swift_con.close()
26 finally:
27- shutil.rmtree(work_dir)
28+ shutil.rmtree(work_dir, ignore_errors=True)
29
30 global amqp_con
31 complete_amqp = amqp_con.channel()

Subscribers

People subscribed via source and target branches