From 6d1c8de4ed672b95f751da86f2505762ce648e61 Mon Sep 17 00:00:00 2001 From: lucas-benedito <55454581+lucas-benedito@users.noreply.github.com> Date: Wed, 2 Aug 2023 16:27:20 +0200 Subject: [PATCH] Fix trial status and host limit with sub (#14237) Co-authored-by: Lucas Benedito --- awx/main/access.py | 2 +- awx/main/utils/licensing.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/awx/main/access.py b/awx/main/access.py index 277076d74149..730c0decf779 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -366,7 +366,7 @@ def check_license(self, add_host_name=None, feature=None, check_expiration=True, report_violation = lambda message: None else: report_violation = lambda message: logger.warning(message) - if validation_info.get('trial', False) is True or validation_info['instance_count'] == 10: # basic 10 license + if validation_info.get('trial', False) is True: def report_violation(message): # noqa raise PermissionDenied(message) diff --git a/awx/main/utils/licensing.py b/awx/main/utils/licensing.py index b5e8957e3247..8e621e1312c0 100644 --- a/awx/main/utils/licensing.py +++ b/awx/main/utils/licensing.py @@ -175,7 +175,12 @@ def _can_aggregate(sub, license): license.setdefault('pool_id', sub['pool']['id']) license.setdefault('product_name', sub['pool']['productName']) license.setdefault('valid_key', True) - license.setdefault('license_type', 'enterprise') + if sub['pool']['productId'].startswith('S'): + license.setdefault('trial', True) + license.setdefault('license_type', 'trial') + else: + license.setdefault('trial', False) + license.setdefault('license_type', 'enterprise') license.setdefault('satellite', False) # Use the nearest end date endDate = parse_date(sub['endDate'])