[PATCH 02/26] lucid: skip command logging for skipped/unreachable

Daniel Gomez <[email protected]> Tue, 19 May 2026 15:27:59 +0200
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Daniel Gomez <[email protected]>

Skipped and unreachable results never carry a resolved command in
result._result because Ansible does not render the task's Jinja2 for
those outcomes. Calling _get_task_command on them either returned
nothing or would have logged an unresolved template string if raw
fallbacks were still in place.

Gate the command-logging block in _log_result on the status so it only
runs for outcomes that actually have a resolved command, keeping the
log accurate and avoiding misleading template text for skipped or
unreachable tasks.

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <[email protected]>
---
 callback_plugins/lucid.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/callback_plugins/lucid.py b/callback_plugins/lucid.py
index d3fdd3b9..99848b57 100644
--- a/callback_plugins/lucid.py
+++ b/callback_plugins/lucid.py
@@ -652,10 +652,11 @@ class CallbackModule(CallbackBase):
         log_line = f"  {symbol} [{host_display}] ({time_str})"
         self._write_to_log(log_line)
 
-        # Log command for supported modules
-        command = self._get_task_command(result)
-        if command:
-            self._write_to_log(f"\n$ {command}")
+        # Log command for supported modules (skip for skipped/unreachable — no resolved command)
+        if status not in ("skipped", "unreachable"):
+            command = self._get_task_command(result)
+            if command:
+                self._write_to_log(f"\n$ {command}")
 
         # Always log full output
         if "stdout" in res and res["stdout"]:

-- 
2.53.0