From 30392df9011b65ea1eec360d4b640c4eeaa9b218 Mon Sep 17 00:00:00 2001 From: missytake Date: Sun, 27 Oct 2024 13:56:26 +0100 Subject: [PATCH] cmdeploy: add argument to specify different SSH host than mail_domain --- cmdeploy/src/cmdeploy/cmdeploy.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmdeploy/src/cmdeploy/cmdeploy.py b/cmdeploy/src/cmdeploy/cmdeploy.py index cb744b37..2d199fa0 100644 --- a/cmdeploy/src/cmdeploy/cmdeploy.py +++ b/cmdeploy/src/cmdeploy/cmdeploy.py @@ -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): @@ -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