From 094072f9dcdb6bd603f0e973f3d13c210ad66401 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Thu, 28 May 2015 16:19:55 -0400 Subject: [PATCH] Fix an issue where the single_fact view could still generate a 500 error if mongo wasn't running and system tracking was disabled by the license --- awx/api/serializers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 91dc192d77..f1f8484345 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -39,6 +39,8 @@ from awx.main.models import * # noqa from awx.main.utils import get_type_for_model, get_model_for_type, build_url, timestamp_apiformat from awx.main.redact import REPLACE_STR +from awx.api.license import feature_enabled + from awx.fact.models import * # noqa logger = logging.getLogger('awx.api.serializers') @@ -415,7 +417,7 @@ class BaseFactSerializer(MongoEngineModelSerializer): def get_fields(self): ret = super(BaseFactSerializer, self).get_fields() - if 'module' in ret: + if 'module' in ret and feature_enabled('system_tracking'): choices = [(o, o) for o in FactVersion.objects.all().only('module').distinct('module')] ret['module'] = ChoiceField(source='module', choices=choices, read_only=True, required=False) return ret