Skip to content

Commit fa129f4

Browse files
committed
only use explicit server settings if the host resolves to ip address via ssh config
1 parent 1223b51 commit fa129f4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cmdeploy/src/cmdeploy/tests/plugin.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,16 @@ def __init__(
409409
def _make_transport(self, domain):
410410
"""Build a transport config dict for the given domain."""
411411
addr, password = self.gencreds(domain)
412-
server = self._ssh_config_host_map.get(domain, domain)
413412
transport = {
414413
"addr": addr,
415414
"password": password,
416-
"imapServer": server,
417-
"smtpServer": server,
418415
}
416+
# To support running against local relays without host DNS resolution
417+
# we attempt resolving the domain via ssh-config
418+
# because otherwise core fails to find the address
419+
server = self._ssh_config_host_map.get(domain)
420+
if server is not None:
421+
transport.update({"imapServer": server, "smtpServer": server})
419422
if self.chatmail_config.tls_cert_mode == "self":
420423
transport["certificateChecks"] = "acceptInvalidCertificates"
421424
return transport

0 commit comments

Comments
 (0)