From dfc6ce9f6e7d7714a9fa3767b7852d5258890ece Mon Sep 17 00:00:00 2001 From: eliquinox Date: Sun, 22 Apr 2018 00:47:06 +0100 Subject: [PATCH] Delete lib log missing (#551) * Added log for non existing libraries when trying to delete * Added logging functionality when deleting a library * Added logging functionality when deleting a library --- arctic/arctic.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arctic/arctic.py b/arctic/arctic.py index 65bf7176136f9..3661993ffa174 100644 --- a/arctic/arctic.py +++ b/arctic/arctic.py @@ -1,10 +1,10 @@ import logging import os +import re +import threading import pymongo from pymongo.errors import OperationFailure, AutoReconnect -import threading - from ._util import indent from .auth import authenticate, get_auth from .decorators import mongo_retry @@ -233,6 +233,8 @@ def delete_library(self, library): """ l = ArcticLibraryBinding(self, library) colname = l.get_top_level_collection().name + if not [c for c in l._db.collection_names(False) if re.match(r"^{}([\.].*)?$".format(colname), c)]: + logger.info('Nothing to delete. Arctic library %s does not exist.' % colname) logger.info('Dropping collection: %s' % colname) l._db.drop_collection(colname) for coll in l._db.collection_names():