AIRAVATA-3694 log exception when archive fails so it generates an error email in production
diff --git a/django_airavata/apps/admin/management/commands/archive_user_data.py b/django_airavata/apps/admin/management/commands/archive_user_data.py
index f71de1f..a79b1bc 100644
--- a/django_airavata/apps/admin/management/commands/archive_user_data.py
+++ b/django_airavata/apps/admin/management/commands/archive_user_data.py
@@ -112,6 +112,7 @@
self.stdout.write(self.style.ERROR("Failed while deleting archived data, attempting to roll back"))
with tarfile.open(archive_directory / archive_tarball_filename) as tf:
tf.extractall(path="/")
+ logger.exception(f"[archive_user_data] Failed to delete archived files, but unarchived from tarball {archive_directory / archive_tarball_filename}", exc_info=e)
raise CommandError(f"Failed to delete archived files, but unarchived from tarball {archive_directory / archive_tarball_filename}") from e
self.stdout.write(self.style.SUCCESS("Successfully removed archived user data"))