From babc44c7110e0f91f9990e836da20256c2df9b10 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 2 Nov 2021 19:38:41 +0000 Subject: [PATCH] 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. --- mkosi/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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(): -- 2.47.2