Skip to content

Commit ca1fe1b

Browse files
committed
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.
1 parent 96108bb commit ca1fe1b

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

cmdeploy/src/cmdeploy/cmdeploy.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,24 @@ def run_cmd(args, out):
109109
try:
110110
retcode = out.check_call(cmd, env=env)
111111
if retcode == 0:
112-
if not args.disable_mail:
112+
if not args.disable_mail and not args.dry_run:
113113
print("\nYou can try out the relay by talking to this echo bot: ")
114-
sshexec = SSHExec(args.config.mail_domain, verbose=args.verbose)
115-
print(
116-
sshexec(
117-
call=remote.rshell.shell,
118-
kwargs=dict(command="cat /var/lib/echobot/invite-link.txt"),
114+
echobot_cmd = "cat /var/lib/echobot/invite-link.txt"
115+
if ssh_host in ["localhost", "@local", "@docker"]:
116+
result = (
117+
subprocess.check_output(echobot_cmd, shell=True)
118+
.decode()
119+
.strip()
120+
)
121+
print(result)
122+
else:
123+
echo_sshexec = get_sshexec(ssh_host, verbose=args.verbose)
124+
print(
125+
echo_sshexec(
126+
call=remote.rshell.shell,
127+
kwargs=dict(command=echobot_cmd),
128+
)
119129
)
120-
)
121130
out.green("Deploy completed, call `cmdeploy dns` next.")
122131
elif not remote_data["acme_account_url"]:
123132
out.red("Deploy completed but letsencrypt not configured")

0 commit comments

Comments
 (0)