fix issues

pull/410/head
vapao 2021-09-27 19:06:38 +08:00
parent 448412cfa6
commit 4e8299beec
2 changed files with 7 additions and 3 deletions

View File

@ -196,8 +196,9 @@ def _deploy_ext1_host(req, helper, h_id, env):
helper.send_error(h_id, 'no such host')
env.update({'SPUG_HOST_ID': h_id, 'SPUG_HOST_NAME': host.hostname})
with host.get_ssh(default_env=env) as ssh:
base_dst_dir = os.path.dirname(extend.dst_dir)
code, _ = ssh.exec_command_raw(
f'mkdir -p {extend.dst_repo} && [ -e {extend.dst_dir} ] && [ ! -L {extend.dst_dir} ]')
f'mkdir -p {extend.dst_repo} {base_dst_dir} && [ -e {extend.dst_dir} ] && [ ! -L {extend.dst_dir} ]')
if code == 0:
helper.send_error(host.id, f'检测到该主机的发布目录 {extend.dst_dir!r} 已存在为了数据安全请自行备份后删除该目录Spug 将会创建并接管该目录。')
if req.type == '2':

View File

@ -74,8 +74,11 @@ class SSH:
channel.send(command)
out, exit_code = '', -1
for line in self.stdout:
if self.regex.search(line):
exit_code = int(line.rsplit()[-1])
match = self.regex.search(line)
if match:
exit_code = int(match.group(1))
line = line[:match.start()]
out += line
break
out += line
return exit_code, out