diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-02-28 05:54:48 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-02-28 05:56:58 +0000 |
| commit | f0d5df523b982ef1737dc0ee2e698b13041af64c (patch) | |
| tree | a2a8cd2c8ca465aa644fc4eb1a3162224b0d7124 /nova/compat | |
| parent | f01b9b8dd25d763e652259a0f99264d93661b29f (diff) | |
Add utils.tempdir() context manager for easy temp dirs
Fixes bug 883323 (and others)
Users of tempfile.mkdtemp() need to make sure the directory is cleaned
up when it's done being used. Unfortunately, not all of the code does
so at all, or safely (by using a try/finally block).
Change-Id: I270109d83efec4f8b3dd954021493f4d96c6ab79
Diffstat (limited to 'nova/compat')
| -rw-r--r-- | nova/compat/flagfile.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/nova/compat/flagfile.py b/nova/compat/flagfile.py index 8721d3485..02d571cbf 100644 --- a/nova/compat/flagfile.py +++ b/nova/compat/flagfile.py @@ -175,6 +175,8 @@ def handle_flagfiles_managed(args): # Do stuff # Any temporary fils have been removed ''' + # NOTE(johannes): Would be nice to use utils.tempdir(), but it + # causes an import loop tempdir = tempfile.mkdtemp(prefix='nova-conf-') try: yield handle_flagfiles(args, tempdir=tempdir) |
