1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

Save settings.LICENSE as dict instead of str.

This commit is contained in:
Chris Church 2016-09-30 15:30:34 -04:00
parent 16ef45f096
commit 70e489d62f

View File

@ -246,16 +246,16 @@ class ApiV1ConfigView(APIView):
try:
from awx.main.task_engine import TaskEnhancer
license_data = json.loads(data_actual)
license_data = TaskEnhancer(**license_data).validate_enhancements()
license_data_validated = TaskEnhancer(**license_data).validate_enhancements()
except Exception:
# FIX: Log
return Response({"error": "Invalid License"}, status=status.HTTP_400_BAD_REQUEST)
# If the license is valid, write it to the database.
if license_data['valid_key']:
settings.LICENSE = data_actual
if license_data_validated['valid_key']:
settings.LICENSE = license_data
settings.TOWER_URL_BASE = "{}://{}".format(request.scheme, request.get_host())
return Response(license_data)
return Response(license_data_validated)
return Response({"error": "Invalid license"}, status=status.HTTP_400_BAD_REQUEST)