apt-stresstest-charm should cleanup legacy chdist directories

Bug #1915791 reported by Thomas Cuthbert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
APT Stress Test Charm
Fix Released
Medium
Haw Loeung

Bug Description

The chdist directory will sometimes contain legacy repositories. The charm/script should look ahead to see if it has enough disk space to do its work OR if that's too difficult, should provide some utility cron tasks to cleanup repositories that haven't changed in a while.

/home/apt-stresstest/.chdist$ sudo find . -maxdepth 1 -type d -mtime +1 -printf "%p\t%TY-%Tm-%Td %TH:%TM:%TS %Tz\n"
./redacted-xenial 2020-10-19 23:31:01.8581672230 +0000
./redacted-xenial 2020-10-19 23:32:18.2271109110 +0000
./redacted-xenial 2020-10-19 23:32:31.6552768280 +0000
[...]

I noticed that the charm already does some cleanup for the /tmp directory, perhaps we just need to add another line to cleanup /home/apt-stresstest/.chdist?:

# reactive/apt_stresstest.py
 28 APT_STRESSTEST_CRONTAB_TEMPLATE = """\
 29 #
 30 # This file is managed by Juju. Attempt no changes here.
 31 #
 32
 33 SHELL=/bin/sh
 34 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 35 * * * * * {user} [ $(pgrep -u {user} -c timeout) -lt 4 ] && timeout {stresstest_timeout} /usr/local/bin/test_apt_mirrors.py {args} -s 127.0.0.1:8094
 36
 37 # Clean up left over downloads from previous test. This is likely due to hitting the run timeout.
 38 */10 * * * * {user} find /tmp -maxdepth 1 -type d -name 'apt-stresstest-*' -mmin +{cleanup_time} -exec rm -rf {{}} +
 39 """ # NOQA: E501

Related branches

summary: - apt-stresstest-charm should cleanup after itself better
+ apt-stresstest-charm should cleanup legacy cdhist directories
Haw Loeung (hloeung)
summary: - apt-stresstest-charm should cleanup legacy cdhist directories
+ apt-stresstest-charm should cleanup legacy chdist directories
Changed in apt-stresstest-charm:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Haw Loeung (hloeung)
Haw Loeung (hloeung)
Changed in apt-stresstest-charm:
status: In Progress → Fix Committed
Haw Loeung (hloeung)
Changed in apt-stresstest-charm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.