summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2020-03-05 08:14:28 +0100
committerRamón M. Gómez <ramongomez@us.es>2020-03-05 08:14:28 +0100
commitf12387bbd821643f848411a380f26152c6834470 (patch)
treeb269e9cec11b2433f204debc56c268ed16744573
parentd230bb755c52c4c2bd7842d855a488db562b8fc7 (diff)
#962: Fix bug when OGAgent processes script lines; now it's not necessary to use escape characters in script input box.
-rw-r--r--admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py4
1 files changed, 2 insertions, 2 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 d9ea7438..4e3c613a 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,8 +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;' +\
- ';'.join(['subprocess.check_output({},shell=True)'.format(c) for c in script.split('\n')])
+ script = 'import subprocess;{0}'.format(
+ ';'.join(['subprocess.check_output({0},shell=True)'.format(repr(c)) for c in script.split('\n')]))
# Executing script.
if post_params.get('client', 'false') == 'false':
thr = ScriptExecutorThread(script)