From cbc9528836f81230182b9fe24c4885f139f8c088 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 14 Jul 2022 15:22:02 +0200 Subject: [PATCH] update prerun.py --- README.txt | 1 + ckan/setup/prerun.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index 5853a3f..d8e190b 100644 --- a/README.txt +++ b/README.txt @@ -29,6 +29,7 @@ Go through all the new changes in the current repo and use those for the new rep - Check out Florian's repo https://github.com/dbca-wa/ckan/tree/dbca2022 - Documentation to be re-done from scratch...anything that could be useful can be mentioned here eg: local storage for ckan.ini +- Had to update the prerun.py script as it was failing on check_solr_connection ToDo (workarounds to fix) diff --git a/ckan/setup/prerun.py b/ckan/setup/prerun.py index 58c4b7c..b148d78 100644 --- a/ckan/setup/prerun.py +++ b/ckan/setup/prerun.py @@ -11,6 +11,7 @@ except ImportError: import time import re +import json ckan_ini = os.environ.get("CKAN_INI", "/srv/app/ckan.ini") @@ -72,7 +73,7 @@ def check_solr_connection(retry=None): sys.exit(1) url = os.environ.get("CKAN_SOLR_URL", "") - search_url = "{url}/select/?q=*&wt=json".format(url=url) + search_url = '{url}/schema/name?wt=json'.format(url=url) try: connection = urlopen(search_url) @@ -82,7 +83,13 @@ def check_solr_connection(retry=None): time.sleep(10) check_solr_connection(retry=retry - 1) else: - eval(connection.read()) + import re + conn_info = connection.read() + schema_name = json.loads(conn_info) + if 'ckan' in schema_name['name']: + print('[prerun] Succesfully connected to solr and CKAN schema loaded') + else: + print('[prerun] Succesfully connected to solr, but CKAN schema not found') def init_db():