From c989679ba3c00668b46d52b39b6a19f23522aa47 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 28 Dec 2023 05:15:30 +0100 Subject: [PATCH] Complain about using --line_match=Started/Stopped which is irrelevant/counterproductive --- package_linter.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package_linter.py b/package_linter.py index edda9cb..26f86bd 100755 --- a/package_linter.py +++ b/package_linter.py @@ -2548,6 +2548,14 @@ class Script(TestSuite): "Please do not use 'systemctl start' to start services. Instead, you should use 'ynh_systemd_action' which will display the service log in case it fails to start. You can also use '--line_match' to wait until some specific word appear in the log, signaling the service indeed fully started." ) + @test() + def bad_line_match(self): + + if self.containsregex(r'--line_match=Started$') or self.containsregex(r'--line_match=Stopped$'): + yield Warning( + 'Using --line_match="Started" or "Stopped" in ynh_systemd_action is counter productive because it will match the systemd message and not the actual app message ... Please check the log of the service to find an actual, relevant message to match, or remove the --line_match option entirely' + ) + @test() def quiet_systemctl_enable(self):