mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 12:28:06 +00:00
Fix issues with echobot invite link in cmdeploy
The entire stack is setup to support 'localhost' as a value for ssh_host, returning LocalExec when that is the case, but this last step made a new explicit SSHExec connection to config.mail_domain. This changes that to simply use the subprocess module when ssh_host is local. This also fixes the issue where the connection was made to 'config.mail_domain' instead of the supplied ssh_host value, ensuring that remains consistent. Additionally, the entire process will be skipped if --dry-run is used with cmdeploy, allowing a dry-run to complete without error.
This commit is contained in:
committed by
missytake
parent
166bf68915
commit
22c303ed7c
@@ -109,15 +109,24 @@ def run_cmd(args, out):
|
|||||||
try:
|
try:
|
||||||
retcode = out.check_call(cmd, env=env)
|
retcode = out.check_call(cmd, env=env)
|
||||||
if retcode == 0:
|
if retcode == 0:
|
||||||
if not args.disable_mail:
|
if not args.disable_mail and not args.dry_run:
|
||||||
print("\nYou can try out the relay by talking to this echo bot: ")
|
print("\nYou can try out the relay by talking to this echo bot: ")
|
||||||
sshexec = SSHExec(args.config.mail_domain, verbose=args.verbose)
|
echobot_cmd = "cat /var/lib/echobot/invite-link.txt"
|
||||||
print(
|
if ssh_host in ["localhost", "@local", "@docker"]:
|
||||||
sshexec(
|
result = (
|
||||||
call=remote.rshell.shell,
|
subprocess.check_output(echobot_cmd, shell=True)
|
||||||
kwargs=dict(command="cat /var/lib/echobot/invite-link.txt"),
|
.decode()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
print(result)
|
||||||
|
else:
|
||||||
|
echo_sshexec = get_sshexec(ssh_host, verbose=args.verbose)
|
||||||
|
print(
|
||||||
|
echo_sshexec(
|
||||||
|
call=remote.rshell.shell,
|
||||||
|
kwargs=dict(command=echobot_cmd),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
out.green("Deploy completed, call `cmdeploy dns` next.")
|
out.green("Deploy completed, call `cmdeploy dns` next.")
|
||||||
elif not remote_data["acme_account_url"]:
|
elif not remote_data["acme_account_url"]:
|
||||||
out.red("Deploy completed but letsencrypt not configured")
|
out.red("Deploy completed but letsencrypt not configured")
|
||||||
|
|||||||
Reference in New Issue
Block a user