Skip to content

Commit

Permalink
cmdeploy: add argument to specify different SSH host than mail_domain
Browse files Browse the repository at this point in the history
  • Loading branch information
missytake committed Oct 27, 2024
1 parent 3e646ef commit ec5ce1f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmdeploy/src/cmdeploy/cmdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def run_cmd_options(parser):
action="store_true",
help="install/upgrade the server, but disable postfix & dovecot for now"
)
parser.add_argument(
"--ssh-host",
dest="ssh_host",
help="specify an SSH host to deploy to; uses mail_domain from chatmail.ini by default"
)


def run_cmd(args, out):
Expand All @@ -73,7 +78,8 @@ def run_cmd(args, out):
env["CHATMAIL_DISABLE_MAIL"] = "True" if args.disable_mail else ""
deploy_path = importlib.resources.files(__package__).joinpath("deploy.py").resolve()
pyinf = "pyinfra --dry" if args.dry_run else "pyinfra"
cmd = f"{pyinf} --ssh-user root {args.config.mail_domain} {deploy_path} -y"
ssh_host = args.config.mail_domain if not args.ssh_host else args.ssh_host
cmd = f"{pyinf} --ssh-user root {ssh_host} {deploy_path} -y"
if version.parse(pyinfra.__version__) < version.parse("3"):
out.red("Please re-run scripts/initenv.sh to update pyinfra to version 3.")
return 1
Expand Down

0 comments on commit ec5ce1f

Please sign in to comment.