Complain about using --line_match=Started/Stopped which is irrelevant/counterproductive

This commit is contained in:
Alexandre Aubin 2023-12-28 05:15:30 +01:00
parent a8e5c7e67e
commit c989679ba3

View file

@ -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." "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() @test()
def quiet_systemctl_enable(self): def quiet_systemctl_enable(self):