mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00
tasks: support running non-shell commands
Allow passing a list to run_update_command() instead of a string which will run the command directly instead of within the shell. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
7f3b4934a9
commit
d3de65c924
|
@ -40,8 +40,11 @@ def run_update_command(self, branch_name, update_command):
|
||||||
updateobj.started = datetime.now()
|
updateobj.started = datetime.now()
|
||||||
updateobj.save()
|
updateobj.save()
|
||||||
output = ''
|
output = ''
|
||||||
update_command = update_command.replace('%update%', str(updateobj.id))
|
shell = False
|
||||||
update_command = update_command.replace('%branch%', branch_name)
|
if isinstance(update_command, str):
|
||||||
|
update_command = update_command.replace('%update%', str(updateobj.id))
|
||||||
|
update_command = update_command.replace('%branch%', branch_name)
|
||||||
|
shell = True
|
||||||
try:
|
try:
|
||||||
os.makedirs(settings.TASK_LOG_DIR)
|
os.makedirs(settings.TASK_LOG_DIR)
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
|
@ -50,7 +53,7 @@ def run_update_command(self, branch_name, update_command):
|
||||||
retcode = 0
|
retcode = 0
|
||||||
erroutput = None
|
erroutput = None
|
||||||
try:
|
try:
|
||||||
output = utils.runcmd(update_command, os.path.dirname(os.path.dirname(__file__)), outfile=logfile, shell=True)
|
output = utils.runcmd(update_command, os.path.dirname(os.path.dirname(__file__)), outfile=logfile, shell=shell)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
output = e.output
|
output = e.output
|
||||||
erroutput = output
|
erroutput = output
|
||||||
|
|
Loading…
Reference in New Issue
Block a user