Have ConfigManager cleanup its temporary directory on destruction (LP #1959729) - #259
Conversation
Codecov Report
@@ Coverage Diff @@
## main #259 +/- ##
=======================================
Coverage 99.14% 99.14%
=======================================
Files 60 60
Lines 10494 10511 +17
=======================================
+ Hits 10404 10421 +17
Misses 90 90
Continue to review full report at Codecov.
|
slyon
left a comment
There was a problem hiding this comment.
Thank you Brian, this issue has been bugging me for a long time!
Your code provides a clean and self-contained solution to this problem and I like this approach.
configmanager.py is currently being reworked heavily (in #255) but the tmpdir cleanup on destruction is a good thing to have independently. All tests and coverage are passing (I ran the integration tests locally, see below). This is ready for merging.
autopkgtest [10:44:40]: @@@@@@@@@@@@@@@@@@@@ summary
ovs PASS
ethernets PASS
bridges PASS
bonds PASS
routing PASS
vlans PASS
wifi PASS
tunnels PASS
scenarios PASS
regressions PASS
autostart PASS
cloud-init PASS
|
Late to the party, but thanks for looking into this. I'd noticed a whole bunch of netplan dirs in /tmp a while back but I assumed it was operator error (I'd usually force-kill the test suite a bunch of time when investigating stuff with gdb). |
Description
ConfigManagercreates a temporary directory on instantiation and relies on the caller to clean up that temporary directory despite never exposed directly to the caller. Due to the code structure in several places, it would be onerous to callConfigManager.cleanup()everywhere it's needed so this patch instead calls.cleanup()whenever the ConfigManager instance is garage collected.This addresses https://bugs.launchpad.net/netplan/+bug/1959729
Checklist
make checksuccessfully.make check-coverage).