U 优化发布目录已存在的提示信息

pull/137/head
vapao 2020-06-09 10:21:46 +08:00
parent 5c0504d694
commit 98f3fdf57d
1 changed files with 1 additions and 1 deletions

View File

@ -139,7 +139,7 @@ def _deploy_ext1_host(helper, h_id, extend, env):
if env.SPUG_DEPLOY_TYPE != '2': if env.SPUG_DEPLOY_TYPE != '2':
code, _ = ssh.exec_command(f'mkdir -p {extend.dst_repo} && [ -e {extend.dst_dir} ] && [ ! -L {extend.dst_dir} ]') code, _ = ssh.exec_command(f'mkdir -p {extend.dst_repo} && [ -e {extend.dst_dir} ] && [ ! -L {extend.dst_dir} ]')
if code == 0: if code == 0:
helper.send_error(host.id, f'please make sure the {extend.dst_dir!r} is not exists.') helper.send_error(host.id, f'检测到该主机的发布目录 {extend.dst_dir!r} 已存在为了数据安全请自行备份后删除该目录Spug 将会创建并接管该目录。')
# clean # clean
clean_command = f'ls -d {extend.deploy_id}_* 2> /dev/null | sort -t _ -rnk2 | tail -n +{extend.versions + 1} | xargs rm -rf' clean_command = f'ls -d {extend.deploy_id}_* 2> /dev/null | sort -t _ -rnk2 | tail -n +{extend.versions + 1} | xargs rm -rf'
helper.remote(host.id, ssh, f'cd {extend.dst_repo} && rm -rf {env.SPUG_VERSION} && {clean_command}') helper.remote(host.id, ssh, f'cd {extend.dst_repo} && rm -rf {env.SPUG_VERSION} && {clean_command}')