#750: Renaming server REST route {{{GET /done}}} to {{{GET /command_done}}} to log commands executed on clients.

oglive^2^2^2
Ramón M. Gómez 2018-07-05 13:50:17 +02:00
parent 91bdf9040d
commit da9bd96ec8
1 changed files with 11 additions and 1 deletions

View File

@ -364,7 +364,7 @@ class OpenGnSysWorker(ServerWorker):
route = post_params.get('redirect_url')
# Checking if the thread id. exists
for c in self.commands:
if c.getName() == op_id:
if c.getName() == str(op_id):
raise Exception('Task id. already exists: {}'.format(op_id))
# Launching a new thread
thr = threading.Thread(name=op_id, target=self.task_command, args=(script, route, op_id))
@ -393,6 +393,16 @@ class OpenGnSysWorker(ServerWorker):
data.append(c.__dict__['_Thread__args'])
return data
def process_stopcmd(self, path, get_params, post_params, server):
logger.debug('Received stopcmd operation with params {}:'.format(post_params))
self.checkSecret(server)
op_id = post_params.get('trace')
for c in self.commands:
if c.is_alive() and c.getName() == str(op_id):
c._Thread__stop()
return {"stopped": op_id}
return {}
def process_hardware(self, path, get_params, post_params, server):
"""
Returns client's hardware profile