mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Catch exceptions if there are issues communicating with mongo
This commit is contained in:
@@ -10,6 +10,7 @@ from awx.fact.models.fact import * # noqa
|
|||||||
from awx.main.socket import Socket
|
from awx.main.socket import Socket
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.commands.run_fact_cache_receiver')
|
logger = logging.getLogger('awx.main.commands.run_fact_cache_receiver')
|
||||||
|
|
||||||
class FactCacheReceiver(object):
|
class FactCacheReceiver(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.timestamp = None
|
self.timestamp = None
|
||||||
@@ -48,7 +49,10 @@ class FactCacheReceiver(object):
|
|||||||
host.save()
|
host.save()
|
||||||
except FactHost.MultipleObjectsReturned:
|
except FactHost.MultipleObjectsReturned:
|
||||||
query = "db['fact_host'].find(hostname=%s)" % hostname
|
query = "db['fact_host'].find(hostname=%s)" % hostname
|
||||||
print('Database inconsistent. Multiple FactHost "%s" exist. Try the query %s to find the records.' % (hostname, query))
|
logger.warn('Database inconsistent. Multiple FactHost "%s" exist. Try the query %s to find the records.' % (hostname, query))
|
||||||
|
return
|
||||||
|
except Exception, e:
|
||||||
|
logger.error("Exception communicating with Mongo: %s" % str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
(module, facts) = self.process_facts(facts_data)
|
(module, facts) = self.process_facts(facts_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user