From e50c2c2867243c6db64570f6dc8ee7934b028f4b Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 23 Oct 2020 11:42:35 -0400 Subject: [PATCH] warn about legacy license usage in the licensing UI --- awx/api/views/root.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/awx/api/views/root.py b/awx/api/views/root.py index 8818b06ee1..9c817ec7b1 100644 --- a/awx/api/views/root.py +++ b/awx/api/views/root.py @@ -1,6 +1,7 @@ # Copyright (c) 2018 Ansible, Inc. # All Rights Reserved. +import base64 import json import logging import operator @@ -353,6 +354,15 @@ class ApiV2ConfigView(APIView): if 'license_key' in license_data: return Response({"error": _('Legacy license submitted. A subscription manifest is now required.')}, status=status.HTTP_400_BAD_REQUEST) if 'manifest' in license_data: + try: + json_actual = json.loads(base64.b64decode(license_data['manifest'])) + if 'license_key' in json_actual: + return Response( + {"error": _('Legacy license submitted. A subscription manifest is now required.')}, + status=status.HTTP_400_BAD_REQUEST + ) + except Exception: + pass try: license_data = validate_entitlement_manifest(license_data['manifest']) except ValueError as e: