You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
From 78840f4e0bd41d3ba1b3c90b909e6c2cf7ef4ea7 Mon Sep 17 00:00:00 2001
|
|
From: Petr Lautrbach <plautrba@redhat.com>
|
|
Date: Wed, 14 Apr 2021 17:03:39 +0200
|
|
Subject: [PATCH] Stop SetroubleshootFixit after 10 seconds of inactivity
|
|
|
|
---
|
|
src/SetroubleshootFixit.py | 9 +++++++++
|
|
1 file changed, 9 insertions(+)
|
|
|
|
diff --git a/framework/src/SetroubleshootFixit.py b/framework/src/SetroubleshootFixit.py
|
|
index 15c6cab..f7cbf95 100644
|
|
--- a/framework/src/SetroubleshootFixit.py
|
|
+++ b/framework/src/SetroubleshootFixit.py
|
|
@@ -7,6 +7,7 @@ from gi.repository import GLib
|
|
import slip.dbus.service
|
|
from slip.dbus import polkit
|
|
import os
|
|
+import signal
|
|
|
|
|
|
class RunFix(slip.dbus.service.Object):
|
|
@@ -14,12 +15,20 @@ class RunFix(slip.dbus.service.Object):
|
|
|
|
def __init__(self, *p, **k):
|
|
super(RunFix, self).__init__(*p, **k)
|
|
+ self.timeout = 10
|
|
+ self.alarm(self.timeout)
|
|
+
|
|
+ def alarm(self, timeout=10):
|
|
+ signal.alarm(timeout)
|
|
+
|
|
|
|
@dbus.service.method("org.fedoraproject.SetroubleshootFixit", in_signature='ss', out_signature='s')
|
|
def run_fix(self, local_id, analysis_id):
|
|
import subprocess
|
|
+ self.alarm(0)
|
|
command = ["sealert", "-f", local_id, "-P", analysis_id]
|
|
return subprocess.check_output(command, universal_newlines=True)
|
|
+ self.alarm(self.timeout)
|
|
|
|
if __name__ == "__main__":
|
|
mainloop = GLib.MainLoop()
|
|
--
|
|
2.30.2
|
|
|