Skip to content

Commit

Permalink
Merge pull request #738 from openedx/ammar/add-more-logs-in-unlink-ex…
Browse files Browse the repository at this point in the history
…pired-licenses-command

feat: add more logs in unlink expired licenses command
  • Loading branch information
muhammad-ammar authored Nov 7, 2024
2 parents 2d55d76 + 04d32e2 commit df16924
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ def unlink_expired_licenses(self, log_prefix, enterprise_customer_uuid, unlink):
user_emails = []

for license in licenses:
logger.info(
"%s Processing. Enterprise: [%s], User: [%s]. License: [%s]",
log_prefix,
enterprise_customer_uuid,
license.get('user_email'),
license.get('uuid')
)

# check if the user associated with the expired license
# has any other active licenses with the same customer
other_active_licenses = License.for_user_and_customer(
Expand All @@ -142,6 +150,12 @@ def unlink_expired_licenses(self, log_prefix, enterprise_customer_uuid, unlink):
current_plans_only=True,
).exists()
if other_active_licenses:
logger.info(
'%s Can not unlink. User has other active licenses. User: [%s]. License: [%s]',
log_prefix,
license.get('user_email'),
license.get('uuid')
)
continue

license_uuids.append(license.get('uuid'))
Expand Down

0 comments on commit df16924

Please sign in to comment.