mirror of
https://github.com/ansible/awx.git
synced 2026-04-14 06:29:25 -02:30
Differentiate the log level depending on whether we are run from the task
This commit is contained in:
@@ -114,23 +114,24 @@ def gather(dest=None, module=None, subset=None, since=None, until=None, collecti
|
|||||||
:param module: the module to search for registered analytic collector
|
:param module: the module to search for registered analytic collector
|
||||||
functions; defaults to awx.main.analytics.collectors
|
functions; defaults to awx.main.analytics.collectors
|
||||||
"""
|
"""
|
||||||
|
log_level = logging.ERROR if collection_type != 'scheduled' else logging.DEBUG
|
||||||
|
|
||||||
if not _valid_license():
|
if not _valid_license():
|
||||||
logger.error("Invalid License provided, or No License Provided")
|
logger.log(log_level, "Invalid License provided, or No License Provided")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if collection_type != 'dry-run':
|
if collection_type != 'dry-run':
|
||||||
if not settings.INSIGHTS_TRACKING_STATE:
|
if not settings.INSIGHTS_TRACKING_STATE:
|
||||||
logger.error("Automation Analytics not enabled. Use --dry-run to gather locally without sending.")
|
logger.log(log_level, "Automation Analytics not enabled. Use --dry-run to gather locally without sending.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not (settings.AUTOMATION_ANALYTICS_URL and settings.REDHAT_USERNAME and settings.REDHAT_PASSWORD):
|
if not (settings.AUTOMATION_ANALYTICS_URL and settings.REDHAT_USERNAME and settings.REDHAT_PASSWORD):
|
||||||
logger.debug('Not gathering analytics, configuration is invalid')
|
logger.log(log_level, "Not gathering analytics, configuration is invalid")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
with advisory_lock('gather_analytics_lock', wait=False) as acquired:
|
with advisory_lock('gather_analytics_lock', wait=False) as acquired:
|
||||||
if not acquired:
|
if not acquired:
|
||||||
logger.debug('Not gathering analytics, another task holds lock')
|
logger.log(log_level, "Not gathering analytics, another task holds lock")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
from awx.conf.models import Setting
|
from awx.conf.models import Setting
|
||||||
|
|||||||
Reference in New Issue
Block a user