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

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

View File

@ -425,7 +425,7 @@ class OpenGnSysWorker(ServerWorker):
route = post_params.get('redirect_url') route = post_params.get('redirect_url')
# Checking if the thread id. exists # Checking if the thread id. exists
for c in self.commands: 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)) raise Exception('Task id. already exists: {}'.format(op_id))
# Launching a new thread # Launching a new thread
thr = threading.Thread(name=op_id, target=self.task_command, args=(script, route, op_id)) thr = threading.Thread(name=op_id, target=self.task_command, args=(script, route, op_id))
@ -454,6 +454,16 @@ class OpenGnSysWorker(ServerWorker):
data.append(c.__dict__['_Thread__args']) data.append(c.__dict__['_Thread__args'])
return data 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): def process_hardware(self, path, get_params, post_params, server):
""" """
Returns client's hardware profile Returns client's hardware profile