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.
This commit is contained in:
amercader 2018-08-08 15:09:45 +02:00
parent 59e403a760
commit d643d6eb59
1 changed files with 2 additions and 1 deletions

View File

@ -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