Merge pull request #332 from hashbang/master

docker: Fix quoting that breaks some versions of Docker
This commit is contained in:
Anders Ingemann 2016-08-14 10:01:33 +02:00 committed by GitHub
commit b9d63b701d

View file

@ -50,15 +50,9 @@ class PopulateLabels(Task):
for label, value in info.manifest.provider['labels'].items():
labels[label] = value.format(**info.manifest_vars)
# pipes.quote converts newlines into \n rather than just prefixing
# it with a backslash, so we need to escape manually
def escape(value):
value = value.replace('"', '\\"')
value = value.replace('\n', '\\\n')
value = '"' + value + '"'
return value
from pipes import quote
for label, value in labels.items():
info._docker['dockerfile'].append('LABEL {}={}'.format(label, escape(value)))
info._docker['dockerfile'].append('LABEL {}={}'.format(label, quote(value)))
class AppendManifestDockerfile(Task):