From d643d6eb59c3198ecf1b5e86cd6879244fbcae11 Mon Sep 17 00:00:00 2001 From: amercader Date: Wed, 8 Aug 2018 15:09:45 +0200 Subject: [PATCH] Fix sysadmin creation on 2.8 Whitespace changes meant that the check to see if the sysadmin exists no longer works on CKAN 2.8. --- rootfs/setup/app/prerun.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rootfs/setup/app/prerun.py b/rootfs/setup/app/prerun.py index 21dc9b1..ab0c51e 100644 --- a/rootfs/setup/app/prerun.py +++ b/rootfs/setup/app/prerun.py @@ -3,6 +3,7 @@ import sys import subprocess import psycopg2 import urllib2 +import re ckan_ini = os.environ.get('CKAN_INI', '/srv/app/production.ini') @@ -85,7 +86,7 @@ def create_sysadmin(): command = ['paster', '--plugin=ckan', 'user', name, '-c', ckan_ini] out = subprocess.check_output(command) - if 'User: \nNone\n' not in out: + if 'User:None' not in re.sub(r'\s', '', out): print '[prerun] Sysadmin user exists, skipping creation' return