Commit 2ed4d028 authored by Alessandro Elias's avatar Alessandro Elias
Browse files

Merge branch 'issue/527' into 'develop'

SCRUM#527: Improve signal handling

See merge request !30
parents 6faa6626 f86c4a6e
Pipeline #16901 passed with stages
in 8 minutes and 43 seconds
le-epoptes (1.0.1) unstable; urgency=medium
* Add SIGTERM and SIGABRT signal handling (Closes: #527)
-- Lucas Sulzbach <lesuporte@c3sl.ufpr.br> Fri, 08 Jun 2018 11:37:18 -0300
le-epoptes (1.0.0) unstable; urgency=medium
* Refactor the CI deploy code (Closes: #580)
-- Guilherme Becker Agge <lesuporte@c3sl.ufpr.br> Thu, 05 Jul 2018 11:49:57 -0300
le-epoptes (1.0.0) unstable; urgency=medium
* Update lelab's methods calls to the new syntax (Closes: #556)
......
......@@ -94,9 +94,7 @@ class LEEpoptes(object):
if self.wait_for_lelab():
self.open_epoptes()
logging.info("Closing server %s", my_server)
self.conn.remove('epoptes')
logging.debug("Server %s closed", my_server)
self.close_epoptes(my_server)
else:
call_error_dialog("This computer is already registered as an"
......@@ -109,6 +107,13 @@ class LEEpoptes(object):
p = Popen(params, stderr=STDOUT, stdout=PIPE)
p.wait()
def close_epoptes(self, server):
# Remove service
logging.info("Closing server %s", server)
self.conn.remove('epoptes')
logging.debug("Server %s closed", server)
def wait_for_lelab(self):
# Wait for le-lab to register the epoptes service
......@@ -140,17 +145,21 @@ def get_lock(proc_name):
output, err = proc.communicate()
eu = [int(x) for x in output.split()]
for x in eu:
Popen("xdotool windowactivate " + str(x),
shell=True, stdout=PIPE, stderr=PIPE)
sys.exit(1)
Popen("xdotool windowactivate " + str(x), shell=True,
stdout=PIPE, stderr=PIPE)
sys.exit()
def signal_handler(signal, frame):
logging.info("Signal %s received, closing program|frame: %s",
str(signal), str(frame))
return
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGABRT, signal_handler)
get_lock("epoptes")
# Setup log info
loglevel = getattr(logging, 'DEBUG')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment