From: Luca Boccassi Date: Tue, 2 Nov 2021 19:38:41 +0000 (+0000) Subject: ssh: do not print warning if networkd is not running on the host X-Git-Tag: v11~9^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F850%2Fhead;p=thirdparty%2Fmkosi.git ssh: do not print warning if networkd is not running on the host Tools like VSCode can use 'mkosi ssh' but use pexpect, so don't print these warnings as it will break them. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index ae71346a4..6f7f02f44 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -7151,8 +7151,11 @@ def has_networkd_vm_vt() -> bool: def ensure_networkd(args: CommandLineArguments) -> bool: networkd_is_running = run(["systemctl", "is-active", "--quiet", "systemd-networkd"], check=False).returncode == 0 if not networkd_is_running: - warn("--network-veth requires systemd-networkd to be running to initialize the host interface " - "of the veth link ('systemctl enable --now systemd-networkd')") + if args.verb != "ssh": + # Some programs will use 'mkosi ssh' with pexpect, so don't print warnings that will break + # them. + warn("--network-veth requires systemd-networkd to be running to initialize the host interface " + "of the veth link ('systemctl enable --now systemd-networkd')") return False if args.verb == "qemu" and not has_networkd_vm_vt():