From c85b35867d42d3ee8a251231af459648cfbb9c8e Mon Sep 17 00:00:00 2001 From: "Manuel Amador (Rudd-O)" Date: Mon, 13 Mar 2023 13:06:47 +0000 Subject: [PATCH] Nicely ellipsize logged commands. --- ansible-qubes.spec | 2 +- bin/bombshell-client | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ansible-qubes.spec b/ansible-qubes.spec index c7b866f..4bf8082 100644 --- a/ansible-qubes.spec +++ b/ansible-qubes.spec @@ -3,7 +3,7 @@ %define mybuildnumber %{?build_number}%{?!build_number:1} Name: ansible-qubes -Version: 0.0.17 +Version: 0.0.18 Release: %{mybuildnumber}%{?dist} Summary: Inter-VM program execution for Qubes OS AppVMs and StandaloneVMs BuildArch: noarch diff --git a/bin/bombshell-client b/bin/bombshell-client index 9d47bb8..6638c6d 100755 --- a/bin/bombshell-client +++ b/bin/bombshell-client @@ -321,12 +321,18 @@ def quotedargs(): return " ".join(quote(x) for x in sys.argv[1:]) +def quotedargs_ellipsized(cmdlist): + text = " ".join(quote(x for x in sys.argv[1:])) + if len(text) > 80: + text = text[:77] + "..." + return text + def main_master(): set_proc_name("bombshell-client (master) %s" % quotedargs()) global logging logging = LoggingEmu("master") - logging.info("Started with arguments: %s", sys.argv[1:]) + logging.info("Started with arguments: %s", quotedargs_ellipsized(sys.argv[1:])) global debug_enabled args = sys.argv[1:] @@ -419,7 +425,7 @@ def main_remote(): global logging logging = LoggingEmu("remote") - logging.info("Started with arguments: %s", sys.argv[1:]) + logging.info("Started with arguments: %s", quotedargs_ellipsized(sys.argv[1:])) global debug_enabled if "-d" in sys.argv[1:]: @@ -468,10 +474,11 @@ def main_remote(): muxer.name = "remote multiplexer" muxer.start() - logging.info("Started %s", nicecmd) + nicecmd_ellipsized = quotedargs_ellipsized(cmd) + logging.info("Started %s", nicecmd_ellipsized) retval = p.wait() - logging.info("Return code %s for %s", retval, nicecmd) + logging.info("Return code %s for %s", retval, nicecmd_ellipsized) muxer.join() logging.info("Ending bombshell") return retval