diff --git a/hooks.py b/hooks.py index b0c5492076443c6ac01fc8d3fd914354e53268f4_aG9va3MucHk=..f69eb7eca7c06b9bbf027641857d60fddfc77623_aG9va3MucHk= 100644 --- a/hooks.py +++ b/hooks.py @@ -51,10 +51,13 @@ if locations and index_name: es = Elasticsearch(locations and locations.split(',')) # TODO : have a cache so that we don't check index on every transition - if not es.indices.exists(index=index_name): - es.indices.create(index=index_name, - body=INDEX_SETTINGS, - ignore=400) + try: + if not es.indices.exists(index=index_name): + es.indices.create(index=index_name, + body=INDEX_SETTINGS, + ignore=400) + except (ConnectionError, ProtocolError): + log.debug('Failed to index in hook, could not connect to ES') # serializer = self.entity.cw_adapt_to('IFTISerializable') serializer = self.entity.cw_adapt_to('ISerializable') json = serializer.serialize()