]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
ssh: do not print warning if networkd is not running on the host 850/head
authorLuca Boccassi <luca.boccassi@microsoft.com>
Tue, 2 Nov 2021 19:38:41 +0000 (19:38 +0000)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Fri, 5 Nov 2021 12:02:15 +0000 (12:02 +0000)
Tools like VSCode can use 'mkosi ssh' but use pexpect, so don't print
these warnings as it will break them.

mkosi/__init__.py

index ae71346a4e5a6b1e169db8386a88bfe91fb051ea..6f7f02f44485d54a20e9cbc93fec3a120a325ffc 100644 (file)
@@ -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():