update setting wording & add instance-enabled field

This commit is contained in:
Christian Adams 2019-03-20 15:08:29 -04:00
parent 70af2dd66b
commit 58f0e42bd6
4 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -26,7 +26,7 @@ def test_empty():
"team": 0,
"user": 0,
"workflow_job_template": 0,
'unified_job': 0
"unified_job": 0
}