From 9be91433cd8e58b4880dbf4640697ac4669e9e21 Mon Sep 17 00:00:00 2001
From: Slawek Kaplonski <skaplons@redhat.com>
Date: Wed, 27 Jan 2021 22:59:41 +0100
Subject: [PATCH] Fix greping of the journalctl log for neutron notification
 line

In commit [1] simple grep of the journalctl output was replaced with
"--grep" option for journalctl. That is fine as this will grep log on
the remote machine and send less data over the network to the Tobiko
runner but it wasn't working as it should because regex should be
in the quotation marks.
This patch fixes that by adding quotes around regex.

This patch also increase time in which logs are checked. It was only
5 minutes but it's not really reliable e.g. on the gate so it's now
increased to 30 minutes.

[1] https://review.opendev.org/c/x/tobiko/+/764351

Change-Id: I1ad3cd9886e0a85647e5a5f98363b10c49967f2c
---
 tobiko/shell/files/_logs.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tobiko/shell/files/_logs.py b/tobiko/shell/files/_logs.py
index 31a9a8fc4..f0aed46c0 100644
--- a/tobiko/shell/files/_logs.py
+++ b/tobiko/shell/files/_logs.py
@@ -91,8 +91,8 @@ class JournalLogDigger(LogFileDigger):
         try:
             result = sh.execute(["journalctl", '--no-pager',
                                  "--unit", self.filename,
-                                 "--since", "5 minutes ago",
-                                 '--grep', pattern],
+                                 "--since", "30 minutes ago",
+                                 '--grep', "'%s'" % pattern],
                                 **self.execute_params)
         except sh.ShellCommandFailed as ex:
             if ex.stdout.endswith('-- No entries --\n'):