diff options
author | JUN JIE NAN <nanjj@cn.ibm.com> | 2013-06-17 15:23:34 +0800 |
---|---|---|
committer | JUN JIE NAN <nanjj@cn.ibm.com> | 2013-06-20 14:18:02 +0800 |
commit | 971c1652420ca6d6991332a4b745b6a8914462f8 (patch) | |
tree | 71d24f49963d38d9dbead94e4fd2eda544864c5c | |
parent | 70ec26e577acef99228e5e8f7694756f9a50bccf (diff) | |
download | heat-cfntools-971c1652420ca6d6991332a4b745b6a8914462f8.tar.gz |
Delete the temporary directory created by sources handler
Register a hook to delete the temporary directory created by sources
handler at program cfn-init exit.
Change-Id: I821195cf510d35f94b1e7656dacc0dfe308ceeb1
Fixes: bug #1191674
-rw-r--r-- | heat_cfntools/cfntools/cfn_helper.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py index 99908bd..5589133 100644 --- a/heat_cfntools/cfntools/cfn_helper.py +++ b/heat_cfntools/cfntools/cfn_helper.py @@ -18,7 +18,7 @@ Not implemented yet: * command line args - placeholders are ignored """ - +import atexit import ConfigParser import errno import grp @@ -35,6 +35,7 @@ try: except ImportError: rpmutils_present = False import re +import shutil import subprocess import tempfile @@ -560,6 +561,7 @@ class SourcesHandler(object): def _url_to_tmp_filename(self, url): tempdir = tempfile.mkdtemp() + atexit.register(lambda: shutil.rmtree(tempdir, True)) sp = url.split('/') if 'https://github.com' in url: if 'zipball' == sp[-2]: |