simplify how awx "open" licensing works

This commit is contained in:
Ryan Petrello
2020-10-23 10:51:48 -04:00
parent 1f0b1923d7
commit 7c63a6592e
3 changed files with 20 additions and 19 deletions

View File

@@ -187,6 +187,7 @@ class APIView(views.APIView):
'''
Log warning for 400 requests. Add header with elapsed time.
'''
from awx.main.utils.common import get_licenser
#
# If the URL was rewritten, and we get a 404, we should entirely
@@ -223,7 +224,7 @@ class APIView(views.APIView):
response = super(APIView, self).finalize_response(request, response, *args, **kwargs)
time_started = getattr(self, 'time_started', None)
response['X-API-Product-Version'] = get_awx_version()
response['X-API-Product-Name'] = 'AWX' if settings.LICENSE.get('license_type', 'UNLICENSED') in 'open' else 'Red Hat Ansible Tower'
response['X-API-Product-Name'] = 'AWX' if get_licenser().validate().get('license_type') == 'open' else 'Red Hat Ansible Tower'
response['X-API-Node'] = settings.CLUSTER_HOST_ID
if time_started: