From cbdfe552c2b7933dc6841b14701b818f5535f283 Mon Sep 17 00:00:00 2001 From: vapao Date: Thu, 23 Jul 2020 01:37:47 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E6=94=B9=E8=BF=9B=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=8F=91=E5=B8=83=E4=B8=B4=E6=97=B6=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=B8=85=E9=99=A4=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/deploy/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spug_api/apps/deploy/utils.py b/spug_api/apps/deploy/utils.py index 3deaf8a..213d7e2 100644 --- a/spug_api/apps/deploy/utils.py +++ b/spug_api/apps/deploy/utils.py @@ -126,6 +126,7 @@ def _ext2_deploy(req, helper, env): step += 1 helper.send_step('local', 100, '完成\r\n' if step == 2 else '\r\n') + tmp_transfer_file = None for action in host_actions: if action.get('type') == 'transfer': helper.send_info('local', f'{human_time()} 检测到数据传输动作,执行打包... ') @@ -144,8 +145,9 @@ def _ext2_deploy(req, helper, env): else: exclude = ' '.join(f'--exclude={sd_dst}/{x}' for x in files) tar_gz_file = f'{env.SPUG_VERSION}.tar.gz' - helper.local(f'cd {sp_dir} && rm -f {req.deploy_id}_*.tar.gz && tar zcf {tar_gz_file} {exclude} {contain}') + helper.local(f'cd {sp_dir} && tar zcf {tar_gz_file} {exclude} {contain}') helper.send_info('local', '完成\r\n') + tmp_transfer_file = os.path.join(sp_dir, tar_gz_file) break if host_actions: threads, latest_exception = [], None @@ -161,6 +163,8 @@ def _ext2_deploy(req, helper, env): latest_exception = exception if not isinstance(exception, SpugError): helper.send_error(t.h_id, f'Exception: {exception}', False) + if tmp_transfer_file: + os.remove(tmp_transfer_file) if latest_exception: raise latest_exception else: