update prerun.py
This commit is contained in:
parent
5dc55f8693
commit
cbc9528836
@ -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
|
- 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
|
- 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)
|
ToDo (workarounds to fix)
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ except ImportError:
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
ckan_ini = os.environ.get("CKAN_INI", "/srv/app/ckan.ini")
|
ckan_ini = os.environ.get("CKAN_INI", "/srv/app/ckan.ini")
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ def check_solr_connection(retry=None):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
url = os.environ.get("CKAN_SOLR_URL", "")
|
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:
|
try:
|
||||||
connection = urlopen(search_url)
|
connection = urlopen(search_url)
|
||||||
@ -82,7 +83,13 @@ def check_solr_connection(retry=None):
|
|||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
check_solr_connection(retry=retry - 1)
|
check_solr_connection(retry=retry - 1)
|
||||||
else:
|
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():
|
def init_db():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user