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
This commit is contained in:
parent
70ec26e577
commit
971c165242
@ -18,7 +18,7 @@ Not implemented yet:
|
|||||||
* command line args
|
* command line args
|
||||||
- placeholders are ignored
|
- placeholders are ignored
|
||||||
"""
|
"""
|
||||||
|
import atexit
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import errno
|
import errno
|
||||||
import grp
|
import grp
|
||||||
@ -35,6 +35,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
rpmutils_present = False
|
rpmutils_present = False
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
@ -560,6 +561,7 @@ class SourcesHandler(object):
|
|||||||
|
|
||||||
def _url_to_tmp_filename(self, url):
|
def _url_to_tmp_filename(self, url):
|
||||||
tempdir = tempfile.mkdtemp()
|
tempdir = tempfile.mkdtemp()
|
||||||
|
atexit.register(lambda: shutil.rmtree(tempdir, True))
|
||||||
sp = url.split('/')
|
sp = url.split('/')
|
||||||
if 'https://github.com' in url:
|
if 'https://github.com' in url:
|
||||||
if 'zipball' == sp[-2]:
|
if 'zipball' == sp[-2]:
|
||||||
|
Loading…
Reference in New Issue
Block a user