diff --git a/awx/conf/registry.py b/awx/conf/registry.py index 102839ddf3..23c45b078c 100644 --- a/awx/conf/registry.py +++ b/awx/conf/registry.py @@ -175,9 +175,6 @@ class SettingsRegistry(object): # `PENDO_TRACKING_STATE` is disabled for the open source awx license if setting == 'PENDO_TRACKING_STATE' and get_license().get('license_type') == 'open': field_instance.read_only = True - - if setting == 'INSIGHTS_DATA_ENABLED' and get_license().get('license_type') == 'open': - field_instance.read_only = True return field_instance diff --git a/awx/main/analytics/core.py b/awx/main/analytics/core.py index f317e09bc7..2462b88193 100644 --- a/awx/main/analytics/core.py +++ b/awx/main/analytics/core.py @@ -70,13 +70,14 @@ def gather(dest=None, module=None): if last_run < max_interval or not last_run: last_run = max_interval - if not settings.INSIGHTS_DATA_ENABLED: - logger.exception("Insights analytics not enabled") - return if _valid_license() is False: logger.exception("Invalid License provided, or No License Provided") return + + if not settings.INSIGHTS_DATA_ENABLED: + logger.error("Insights analytics not enabled") + return "Error: Insights analytics not enabled" if module is None: from awx.main.analytics import collectors diff --git a/awx/main/tests/functional/analytics/test_core.py b/awx/main/tests/functional/analytics/test_core.py index 56147af156..235bda26be 100644 --- a/awx/main/tests/functional/analytics/test_core.py +++ b/awx/main/tests/functional/analytics/test_core.py @@ -5,6 +5,7 @@ import tarfile import pytest +from django.conf import settings from awx.main.analytics import gather, register @@ -25,6 +26,7 @@ def throws_error(since): @pytest.mark.django_db def test_gather(): + settings.INSIGHTS_DATA_ENABLED = True tgz = gather(module=importlib.import_module(__name__)) files = {} with tarfile.open(tgz, "r:gz") as archive: @@ -42,3 +44,4 @@ def test_gather(): os.remove(tgz) except Exception: pass + diff --git a/awx/main/tests/functional/analytics/test_counts.py b/awx/main/tests/functional/analytics/test_counts.py index affcfef414..a3433d1a6e 100644 --- a/awx/main/tests/functional/analytics/test_counts.py +++ b/awx/main/tests/functional/analytics/test_counts.py @@ -26,7 +26,7 @@ def test_empty(): "team": 0, "user": 0, "workflow_job_template": 0, - 'unified_job': 0 + "unified_job": 0 }