]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Machine name fixes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 5 Aug 2023 15:49:07 +0000 (17:49 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 5 Aug 2023 19:05:54 +0000 (21:05 +0200)
- Prefer the image id or preset name over the output name
- Make sure the machine name doesn't contain underscores as those
  are not allowed.

mkosi/__init__.py

index 028d90395a76c93336faf621beca22a654878459..60c5e7ab42b81adf43d976dc67acc746ebb66716 100644 (file)
@@ -1766,7 +1766,8 @@ def run_shell(args: MkosiArgs, config: MkosiConfig) -> None:
             "--console=autopipe",
         ]
 
-    cmdline += ["--machine", config.output]
+    # Underscores are not allowed in machine names so replace them with hyphens.
+    cmdline += ["--machine", (config.image_id or config.preset or config.output).replace("_", "-")]
 
     for k, v in config.credentials.items():
         cmdline += [f"--set-credential={k}:{v}"]