Switch out existing obfuscated license with external module

This creates a new fallback license module called StubLicense that
will be used in the event that the tower_license module is not
installed.

All existing license mechanisms are routed through the get_licenser()
util method
This commit is contained in:
Matthew Jones
2017-07-11 12:01:24 -04:00
parent 7fda3c0658
commit 8486944eaa
13 changed files with 83 additions and 45 deletions

View File

@@ -324,9 +324,9 @@ class ApiV1ConfigView(APIView):
extra=dict(actor=request.user.username))
return Response({"error": _("Invalid JSON")}, status=status.HTTP_400_BAD_REQUEST)
try:
from awx.main.task_engine import TaskEnhancer
from awx.main.utils.common import get_licenser
license_data = json.loads(data_actual)
license_data_validated = TaskEnhancer(**license_data).validate_enhancements()
license_data_validated = get_licenser(**license_data).validate()
except Exception:
logger.warning(smart_text(u"Invalid license submitted."),
extra=dict(actor=request.user.username))