mirror of
https://github.com/ansible/awx.git
synced 2026-05-22 08:17:39 -02:30
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:
@@ -8,7 +8,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from rest_framework.exceptions import APIException
|
||||
|
||||
# Tower
|
||||
from awx.main.task_engine import TaskEnhancer
|
||||
from awx.main.utils.common import get_licenser
|
||||
|
||||
__all__ = ['LicenseForbids', 'get_license', 'get_licensed_features',
|
||||
'feature_enabled', 'feature_exists']
|
||||
@@ -20,7 +20,7 @@ class LicenseForbids(APIException):
|
||||
|
||||
|
||||
def _get_validated_license_data():
|
||||
return TaskEnhancer().validate_enhancements()
|
||||
return get_licenser().validate()
|
||||
|
||||
|
||||
def get_license(show_key=False):
|
||||
@@ -42,7 +42,10 @@ def get_licensed_features():
|
||||
|
||||
def feature_enabled(name):
|
||||
"""Return True if the requested feature is enabled, False otherwise."""
|
||||
return _get_validated_license_data().get('features', {}).get(name, False)
|
||||
validated_license_data = _get_validated_license_data()
|
||||
if validated_license_data['license_type'] == 'open':
|
||||
return True
|
||||
return validated_license_data.get('features', {}).get(name, False)
|
||||
|
||||
|
||||
def feature_exists(name):
|
||||
|
||||
Reference in New Issue
Block a user