From d8817a2965a054abe7ae0023ca1bbf997d45e1a9 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 13 Jan 2015 17:55:27 -0500 Subject: [PATCH] Fix ACI conversion handling of relative exec commands --- formats/aci.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/formats/aci.py b/formats/aci.py index c02cac857..05f1dce3e 100644 --- a/formats/aci.py +++ b/formats/aci.py @@ -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']