Attempt to fix journalctl 09/24509/2
authorPeter Mikus <pmikus@cisco.com>
Fri, 24 Jan 2020 12:08:52 +0000 (12:08 +0000)
committerPeter Mikus <pmikus@cisco.com>
Fri, 24 Jan 2020 12:23:34 +0000 (12:23 +0000)
- AWK
- ECHO
- pipe
+ Much simpler

Change-Id: I4876f4eae68c96571dc38fd21e53ba269f5f888e
Signed-off-by: Peter Mikus <pmikus@cisco.com>
resources/libraries/python/DUTSetup.py

index 431ccfb..49c3d41 100644 (file)
@@ -35,9 +35,9 @@ class DUTSetup:
         """
         command = u"echo $(< /tmp/*supervisor*.log)"\
             if DUTSetup.running_in_container(node) \
-            else f"journalctl --no-pager --unit={service} " \
-            f"--since=\"$(echo `systemctl show -p ActiveEnterTimestamp " \
-            f"{service}` | awk \'{{print $2 $3}}\')\""
+            else f"journalctl --no-pager _SYSTEMD_INVOCATION_ID=$(systemctl " \
+            f"show -p InvocationID --value {service})"
+
         message = f"Node {node[u'host']} failed to get logs from unit {service}"
 
         exec_cmd_no_error(