summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2020-03-04 16:23:03 +0100
committerRamón M. Gómez <ramongomez@us.es>2020-03-04 16:23:03 +0100
commit810f5e0716de1b40d91dc14a94a06c68dec8e405 (patch)
tree071bb82c2c32e188dc6a9c32d769fb41fcab03ff /admin
parent7db4aa449f8879013092e49535f1f41c454adffc (diff)
#962: OGAgent runs each script line independently to solve a Python for Windows problem.
Diffstat (limited to 'admin')
-rw-r--r--admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py3
1 files changed, 2 insertions, 1 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 24d69ee4..d9ea7438 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
@@ -282,7 +282,8 @@ class OpenGnSysWorker(ServerWorker):
logger.debug('Processing script request')
# Decoding script
script = urllib.unquote(post_params.get('script').decode('base64')).decode('utf8')
- script = 'import subprocess; subprocess.check_output("""{}""",shell=True)'.format(script)
+ script = 'import subprocess;' +\
+ ';'.join(['subprocess.check_output({},shell=True)'.format(c) for c in script.split('\n')])
# Executing script.
if post_params.get('client', 'false') == 'false':
thr = ScriptExecutorThread(script)