From 04d32e2ad8fa8163c174506576630acdfa372b54 Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Thu, 7 Nov 2024 12:14:28 +0500 Subject: [PATCH] feat: add more logs in unlink expired licenses command --- .../management/commands/unlink_expired_licenses.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/license_manager/apps/subscriptions/management/commands/unlink_expired_licenses.py b/license_manager/apps/subscriptions/management/commands/unlink_expired_licenses.py index 8f0b1f03..c997a55a 100644 --- a/license_manager/apps/subscriptions/management/commands/unlink_expired_licenses.py +++ b/license_manager/apps/subscriptions/management/commands/unlink_expired_licenses.py @@ -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( @@ -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'))