diff options
author | Ramón M. Gómez <ramongomez@us.es> | 2019-05-17 11:51:05 +0200 |
---|---|---|
committer | Ramón M. Gómez <ramongomez@us.es> | 2019-05-17 11:51:05 +0200 |
commit | d34b00c51df4dcc5aa88e76361b22ef7c1ff72a8 (patch) | |
tree | 707569ab759d21fe57d7955791473d219cdf037d | |
parent | dde400e2a5aa8756752953a5ef0fcb90f7d8e07a (diff) |
#761 Agent optionally sends back the disks configuration after script execution.
-rw-r--r-- | admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py b/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py index 6e729046..ab31fb39 100644 --- a/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py +++ b/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py @@ -136,7 +136,7 @@ class OpenGnSysWorker(ServerWorker): self.browser['url'] = url self.browser['process'] = subprocess.Popen(['browser', '-qws', url]) - def _task_command(self, route, code, op_id): + def _task_command(self, route, code, op_id, send_config=False): """ Task to execute a command and return results to a server URI :param route: server callback REST route to return results @@ -164,6 +164,10 @@ class OpenGnSysWorker(ServerWorker): 'error': err.encode('utf8').encode('base64')}) # Show latest menu, if OGAgent runs on ogLive if os_type == 'oglive': + # Send configuration data, if needed + if send_config: + self.REST.sendMessage('clients/configs', {'mac': self.interface.mac, 'ip': self.interface.ip, + 'config': operations.get_configuration()}) self._launch_browser(menu_url) def onActivation(self): @@ -397,14 +401,15 @@ class OpenGnSysWorker(ServerWorker): try: script = urllib.unquote(post_params.get('script').decode('base64')).decode('utf8') op_id = post_params.get('id') - route = post_params.get('redirect_uri') + route = post_params.get('redirectUri') + send_config = (post_params.get('sendConfig', 'false') == 'true') # Check if the thread id. exists for c in self.commands: if c.getName() == str(op_id): raise Exception('Task id. already exists: {}'.format(op_id)) if post_params.get('client', 'false') == 'false': # Launching a new thread - thr = threading.Thread(name=op_id, target=self._task_command, args=(route, script, op_id)) + thr = threading.Thread(name=op_id, target=self._task_command, args=(route, script, op_id, send_config)) thr.start() self.commands.append(thr) else: |