cmdeploy: skip warnings only in pyinfra 3; pyinfra crashes otherwise

This commit is contained in:
missytake
2024-07-23 15:37:35 +02:00
committed by holger krekel
parent 89c65d30d3
commit 023253ad9c

View File

@@ -12,6 +12,9 @@ import shutil
import subprocess import subprocess
import sys import sys
from pathlib import Path from pathlib import Path
from packaging import version
import pyinfra
from chatmaild.config import read_config, write_initial_config from chatmaild.config import read_config, write_initial_config
from termcolor import colored from termcolor import colored
@@ -64,7 +67,9 @@ def run_cmd(args, out):
env["CHATMAIL_INI"] = args.inipath env["CHATMAIL_INI"] = args.inipath
deploy_path = importlib.resources.files(__package__).joinpath("deploy.py").resolve() deploy_path = importlib.resources.files(__package__).joinpath("deploy.py").resolve()
pyinf = "pyinfra --dry" if args.dry_run else "pyinfra" pyinf = "pyinfra --dry" if args.dry_run else "pyinfra"
cmd = f"{pyinf} --ssh-user root {args.config.mail_domain} {deploy_path} -y" cmd = f"{pyinf} --ssh-user root {args.config.mail_domain} {deploy_path}"
if version.parse(pyinfra.__version__) >= version.parse("3"):
cmd += " -y"
retcode = out.check_call(cmd, env=env) retcode = out.check_call(cmd, env=env)
if retcode == 0: if retcode == 0: