Skip to content

Commit

Permalink
Fix trial status and host limit with sub (#14237)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Benedito <[email protected]>
  • Loading branch information
lucas-benedito and lucas-benedito authored Aug 2, 2023
1 parent 601b62d commit 6d1c8de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion awx/main/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion awx/main/utils/licensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 6d1c8de

Please sign in to comment.