Merge "Strip blank lines from downloaded clouds.yaml file"

This commit is contained in:
Jenkins 2017-05-02 23:36:18 +00:00 committed by Gerrit Code Review
commit 04c3e96643

View File

@ -171,10 +171,11 @@ def download_clouds_yaml_file(request):
def _download_rc_file_for_template(request, context, template, filename=None): def _download_rc_file_for_template(request, context, template, filename=None):
try: try:
response = shortcuts.render(request, content = render_to_string(template, context, request=request)
template, content = '\n'.join([line for line in content.split('\n')
context, if line.strip()])
content_type="text/plain") response = http.HttpResponse(content, content_type="text/plain")
if not filename: if not filename:
filename = '%s-openrc.sh' % context['tenant_name'] filename = '%s-openrc.sh' % context['tenant_name']
disposition = 'attachment; filename="%s"' % filename disposition = 'attachment; filename="%s"' % filename