Fix ACI conversion handling of relative exec commands

This commit is contained in:
Joseph Schorr 2015-01-13 17:55:27 -05:00
parent 6ed28930b2
commit d8817a2965

View file

@ -136,10 +136,11 @@ class ACIImage(TarImageFormatter):
app.config['SERVER_HOSTNAME'],
namespace, repository, tag)
# ACI requires that the execution command be absolutely referenced. Therefore, if we find
# a relative command, we give it as an argument to /bin/sh to resolve and execute for us.
exec_path = config.get('Cmd', [])
if exec_path:
if not exec_path[0].startswith('/'):
exec_path[0] = '/bin/' + exec_path[0]
if exec_path and not exec_path[0].startswith('/'):
exec_path = ['/bin/sh', '-c', '""%s""' % ' '.join(exec_path)]
# TODO: ACI doesn't support : in the name, so remove any ports.
hostname = app.config['SERVER_HOSTNAME']