← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:cloud-worker-tmp-cleanup into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:cloud-worker-tmp-cleanup into autopkgtest-cloud:master.

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

For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/460680
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:cloud-worker-tmp-cleanup into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/config.yaml b/charms/focal/autopkgtest-cloud-worker/config.yaml
index 7f0ef60..bcb9996 100644
--- a/charms/focal/autopkgtest-cloud-worker/config.yaml
+++ b/charms/focal/autopkgtest-cloud-worker/config.yaml
@@ -110,3 +110,6 @@ options:
     description: Submit all metrics with this as the "context" tag,
                  to differentiate staging vs. production submissions
     type: string
+  worker-tmp-cleanup-config:
+    default: ""
+    description: config for periodic cleanup of /tmp directory
diff --git a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
index 2e8f376..ea41165 100644
--- a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
+++ b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
@@ -567,6 +567,16 @@ def fix_tmp_permissions():
 
 
 @when_any(
+    "config.set.worker-tmp-cleanup-config",
+    "config.changed.worker-tmp-cleanup-config",
+)
+def write_worker_tmp_cleanup_config():
+    cleanup_cfg_str = config().get("worker-tmp-cleanup-config")
+    with open("/etc/tmpfiles.d/tmp.conf", "w") as f:
+        f.write(cleanup_cfg_str)
+
+
+@when_any(
     "config.changed.influxdb-hostname",
     "config.changed.influxdb-port",
     "config.changed.influxdb-username",
diff --git a/mojo/service-bundle b/mojo/service-bundle
index e6b6a1f..ab1c173 100644
--- a/mojo/service-bundle
+++ b/mojo/service-bundle
@@ -75,6 +75,7 @@ applications:
             <<: *common-options
             nova-rcs: include-base64://{{local_dir}}/novarcs.tar
             worker-setup-command2: /CHECKOUTDIR//setup-commands/setup-testbed
+            worker-tmp-cleanup-config: e /tmp 1777 root root 30d
 {%- if stage_name == "production" %}
             net-name: net_prod-proposed-migration
             worker-default-flavor: autopkgtest

Follow ups