1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

include the AWX version as a header in all responses

This commit is contained in:
Ryan Petrello 2020-04-21 17:26:57 -04:00
parent 9fdec9b31b
commit edd9972435
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
2 changed files with 7 additions and 1 deletions

View File

@ -45,7 +45,10 @@ from awx.main.utils import (
get_search_fields,
getattrd,
get_object_or_400,
decrypt_field
decrypt_field,
get_awx_version,
get_licenser,
StubLicense
)
from awx.main.utils.db import get_all_field_names
from awx.api.serializers import ResourceAccessListElementSerializer, CopySerializer, UserSerializer
@ -197,6 +200,8 @@ class APIView(views.APIView):
logger.warning(status_msg)
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 isinstance(get_licenser(), StubLicense) else 'Red Hat Ansible Tower'
response['X-API-Node'] = settings.CLUSTER_HOST_ID
if time_started:
time_elapsed = time.time() - self.time_started

View File

@ -56,6 +56,7 @@ __all__ = [
'has_model_field_prefetched', 'set_environ', 'IllegalArgumentError',
'get_custom_venv_choices', 'get_external_account', 'task_manager_bulk_reschedule',
'schedule_task_manager', 'classproperty', 'create_temporary_fifo', 'truncate_stdout',
'StubLicense'
]