diff --git a/awx/api/views.py b/awx/api/views.py index 423f73aa93..a12214024f 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -279,7 +279,7 @@ class ApiV1ConfigView(APIView): license_info=license_data, version=get_awx_version(), ansible_version=get_ansible_version(), - eula=render_to_string("eula.md") if license_data['license_type'] != 'open' else '', + eula=render_to_string("eula.md") if license_data.get('license_type', 'UNLICENSED') != 'open' else '', analytics_status=pendo_state ) diff --git a/awx/conf/license.py b/awx/conf/license.py index d6772eb4e8..57456f90fa 100644 --- a/awx/conf/license.py +++ b/awx/conf/license.py @@ -43,7 +43,7 @@ def get_licensed_features(): def feature_enabled(name): """Return True if the requested feature is enabled, False otherwise.""" validated_license_data = _get_validated_license_data() - if validated_license_data['license_type'] == 'open': + if validated_license_data.get('license_type', 'UNLICENSED') == 'open': return True return validated_license_data.get('features', {}).get(name, False) diff --git a/awx/main/access.py b/awx/main/access.py index 064abe01b7..b5d84d96fa 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -254,7 +254,7 @@ class BaseAccess(object): def check_license(self, add_host_name=None, feature=None, check_expiration=True): validation_info = get_licenser().validate() - if validation_info['license_type'] == 'open': + if validation_info.get('license_type', 'UNLICENSED') == 'open': return if ('test' in sys.argv or 'py.test' in sys.argv[0] or 'jenkins' in sys.argv) and not os.environ.get('SKIP_LICENSE_FIXUP_FOR_TEST', ''): diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index 28dd627180..e1e4d24170 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -852,7 +852,7 @@ class Command(NoArgsCommand): if license_info.get('license_key', 'UNLICENSED') == 'UNLICENSED': logger.error(LICENSE_NON_EXISTANT_MESSAGE) raise CommandError('No license found!') - elif license_info['license_type'] == 'open': + elif license_info('license_type', 'UNLICENSED') == 'open': return available_instances = license_info.get('available_instances', 0) free_instances = license_info.get('free_instances', 0)