diff --git a/src/azanium/artefact.py b/src/azanium/artefact.py index a15e354..97bd78d 100644 --- a/src/azanium/artefact.py +++ b/src/azanium/artefact.py @@ -10,11 +10,12 @@ Info = collections.namedtuple('Info', ('download_dir', 'install_dir', 'version')) - +DOWNLOAD_DIR = '/tmp/downloads' def prepare(cmd_ctx, func): f_name = func.__name__ - tmpdir = tempfile.mkdtemp(suffix='-db-migration-downloads') + tmpdir = tempfile.mkdtemp(suffix='-db-migration-downloads', + dir=DOWNLOAD_DIR) download_dir = os.path.join(tmpdir, f_name) install_dir = cmd_ctx.path(f_name) version = util.get_deploy_versions()[f_name] @@ -27,7 +28,7 @@ def prepare(cmd_ctx, func): def prepared(func): """Decorator providing a click command function with download/install info. - + Fowards to the original function with addtional ``Info`` object containing details such as install and download disk locations. """ diff --git a/src/azanium/install.py b/src/azanium/install.py index a8f82d6..18f7568 100644 --- a/src/azanium/install.py +++ b/src/azanium/install.py @@ -83,7 +83,6 @@ def tace(context, afct, url_template=None): local_path = downloaded[0] with tarfile.open(local_path) as tf: tf.extract('./tace', path=afct.install_dir) - shutil.rmtree(os.path.dirname(local_path)) tace_path = os.path.join(afct.install_dir, 'tace') util.touch_dir(afct.install_dir) util.make_executable(tace_path, logger) @@ -107,7 +106,6 @@ def datomic_free(context, afct, url_template=None): tmpdir = tempfile.mkdtemp() with zipfile.ZipFile(util.download(url, download_path)) as zf: zf.extractall(tmpdir) - shutil.rmtree(os.path.dirname(download_path)) shutil.rmtree(install_dir) shutil.move(os.path.join(tmpdir, fullname), install_dir) util.touch_dir(install_dir) @@ -141,7 +139,6 @@ def pseudoace(context, afct, **kw): tempdir = tempfile.mkdtemp() with tarfile.open(dl_path) as tf: tf.extractall(path=tempdir) - shutil.rmtree(os.path.dirname(dl_path)) archive_filename = os.path.split(dl_path)[-1] fullname = archive_filename.rsplit('.', 2)[0] tmp_src_path = os.path.join(tempdir, fullname) diff --git a/src/azanium/runcommand.py b/src/azanium/runcommand.py index 8ac48a7..9ee6a3c 100644 --- a/src/azanium/runcommand.py +++ b/src/azanium/runcommand.py @@ -240,6 +240,7 @@ def backup_db(context, db_name=None): @util.pass_command_context def clean_previous_state(context): to_remove = set(installers.commands) | { + artefact.DOWNLOAD_DIR, 'acedb_database', 'acedb_id_catalog', 'acedb-dump',