]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Drop ForwardJournal= integration for coredumpctl and journalctl verbs 3227/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 23 Nov 2024 13:54:59 +0000 (14:54 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 23 Nov 2024 14:02:17 +0000 (15:02 +0100)
Now that we have the sandbox verb, this is trivial to achieve with the
sandbox verb so let's keep the coredumpctl and journalctl verbs focused
solely on reading the journal and coredumps from the image itself and leave
inspecting the forwarded journal to mkosi sandbox.

Technically this breaks compat but I'm convinced nobody's actually using this
specific bit of integration so it shouldn't matter if we remove it.

mkosi/__init__.py
mkosi/resources/man/mkosi.1.md

index 141518d89c4b8f83c7ec5a7cc2ea1b4198e51a58..91e71a67ac0fb9d363db187008882fe40f9ccab2 100644 (file)
@@ -3975,16 +3975,12 @@ def run_shell(args: Args, config: Config) -> None:
 
 
 def run_systemd_tool(tool: str, args: Args, config: Config) -> None:
-    if (
-        config.output_format not in (OutputFormat.disk, OutputFormat.directory)
-        and not config.forward_journal
-    ):
+    if config.output_format not in (OutputFormat.disk, OutputFormat.directory):
         die(f"{config.output_format} images cannot be inspected with {tool}")
 
     if (
         args.verb in (Verb.journalctl, Verb.coredumpctl)
         and config.output_format == OutputFormat.disk
-        and not config.forward_journal
         and os.getuid() != 0
     ):
         need_root = True
@@ -3994,30 +3990,17 @@ def run_systemd_tool(tool: str, args: Args, config: Config) -> None:
     if (tool_path := config.find_binary(tool)) is None:
         die(f"Failed to find {tool}")
 
-    if config.ephemeral and not config.forward_journal:
+    if config.ephemeral:
         die(f"Images booted in ephemeral mode cannot be inspected with {tool}")
 
-    output = config.output_dir_or_cwd() / config.output
-
-    if config.forward_journal and not config.forward_journal.exists():
-        die(
-            "Journal directory/file configured with ForwardJournal= does not exist, "
-            f"cannot inspect with {tool}"
-        )
-    elif not output.exists():
+    if not (output := config.output_dir_or_cwd() / config.output).exists():
         die(
-            f"Output {config.output_dir_or_cwd() / config.output} does not exist, cannot inspect with {tool}"
+            f"Output {output} does not exist, cannot inspect with {tool}",
+            hint=f"Build and boot the image first before inspecting it with {tool}",
         )
 
-    cmd: list[PathString] = [tool_path]
-
-    if config.forward_journal:
-        cmd += ["--directory" if config.forward_journal.is_dir() else "--file", config.forward_journal]
-    else:
-        cmd += ["--root" if output.is_dir() else "--image", output]
-
     run(
-        [*cmd, *args.cmdline],
+        [tool_path, "--root" if output.is_dir() else "--image", output, *args.cmdline],
         stdin=sys.stdin,
         stdout=sys.stdout,
         env=os.environ | config.environment,
index 319a5dd335aafb4f439a86442979eb21ace4247e..8fab1c0f6ab65491eb5669e8dc0e67cf5b9f837d 100644 (file)
@@ -119,18 +119,11 @@ The following command line verbs are known:
     Any arguments specified after the `journalctl` verb are appended to the
     `journalctl` invocation.
 
-    If `ForwardJournal=` is specified, this verb will operate on the
-    forwarded journal instead of the journal inside the image.
-
 `coredumpctl`
 :   Uses `coredumpctl` to look for coredumps inside the image.
     Any arguments specified after the `coredumpctl` verb are appended to the
     `coredumpctl` invocation.
 
-    If `ForwardJournal=` is specified, this verb will operate on the
-    forwarded journal instead of the image. Note that this requires
-    configuring systemd-coredump to store coredumps in the journal.
-
 `sysupdate`
 :   Invokes `systemd-sysupdate` with the `--transfer-source=` option set
     to the output directory and the `--definitions=` option set to the