Skip to content

Commit 7692551

Browse files
zelimaamercader
andauthored
Make sure all variables are defined + handle exception in a better way (#142)
* Make sure all variables are defined + handle exception in a better way Co-authored-by: Adrià Mercader <amercadero@gmail.com>
1 parent a299bdf commit 7692551

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

ckan_cloud_operator/providers/solr/manager.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,15 @@ def get_collection_status(collection_name):
9898
'collection_name': collection_name,
9999
'solr_http_endpoint': get_internal_http_endpoint()}
100100
else:
101-
102-
res = {'schema': {'version': '2.8', 'name': 'ckan'}}
101+
def_ver, def_name = '2.8', 'ckan'
102+
res = {'schema': {'version': def_ver, 'name': def_name}}
103103
try:
104-
res = json.loads(new_output)
105-
except:
106-
pass
104+
res = json.loads(output)
105+
except json.decoder.JSONDecodeError as e:
106+
logs.warning(
107+
f'Not able to decode response from SOLR. Using default values for schema version/name - {def_ver}/{def_name}\n SOLR response: \n{output}'
108+
)
109+
107110
return {'ready': True,
108111
'collection_name': collection_name,
109112
'solr_http_endpoint': get_internal_http_endpoint(),

0 commit comments

Comments
 (0)