Project

General

Profile

Actions

Bug #10113

closed

User story #9714: Remote run API should use relay API

asynchronous call on relay remote run api makes an error

Added by Vincent MEMBRÉ about 7 years ago. Updated about 7 years ago.

Status:
Released
Priority:
1
Category:
API
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:

Description

We call subprocess.popen with "command &" and shell parameter (default to false)

This leads to an error:

[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1] mod_wsgi (pid=5950): Exception occurred processing WSGI script '/opt/rudder/share/relay-api/relay-api.wsgi'.
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]   File "/opt/rudder/share/relay-api/flask/lib/python2.6/site-packages/werkzeug/wsgi.py", line 703, in __next__
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]     return self._next()
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]   File "/opt/rudder/share/relay-api/flask/lib/python2.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]     for item in iterable:
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]   File "/opt/rudder/share/relay-api/relay_api/remote_run.py", line 177, in generate_output
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]     yield call_remote_run(host, node, classes, keep_output, asynchronous)
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]   File "/opt/rudder/share/relay-api/relay_api/remote_run.py", line 93, in call_remote_run
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]     return run_command(REMOTE_RUN_COMMAND + classes_parameter + " " + host, uuid, keep_output, asynchronous)
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]   File "/opt/rudder/share/relay-api/relay_api/remote_run.py", line 106, in run_command
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]     process = Popen(command)
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]   File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]     errread, errwrite)
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]   File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1]     raise child_exception
[Wed Feb 01 15:38:05 2017] [error] [client 127.0.0.1] OSError: [Errno 2] No such file or directory

We should use shell=True as parameter

Actions

Also available in: Atom PDF