From 17139f1f82cd671137b83c2b019515e3d2ee7df3 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 20 May 2020 11:03:13 -0400 Subject: [PATCH] Always check configuration before gathering data. We shouldn't perform expensive operations if we won't be able to send it. Only log at debug level, otherwise every node will log this every 5 minutes. --- awx/main/tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index b84c93d924..360076e7d8 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -358,6 +358,9 @@ def gather_analytics(): from rest_framework.fields import DateTimeField if not settings.INSIGHTS_TRACKING_STATE: return + if not (settings.AUTOMATION_ANALYTICS_URL and settings.REDHAT_USERNAME and settings.REDHAT_PASSWORD): + logger.debug('Not gathering analytics, configuration is invalid') + return last_gather = Setting.objects.filter(key='AUTOMATION_ANALYTICS_LAST_GATHER').first() if last_gather: last_time = DateTimeField().to_internal_value(last_gather.value)