mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
OP-3426 - raise better exception if mongorestore not found
This commit is contained in:
parent
8aa05190c6
commit
fc99a9a35e
1 changed files with 6 additions and 2 deletions
|
|
@ -118,7 +118,7 @@ class DBHandler:
|
|||
"Run with overwrite=True")
|
||||
else:
|
||||
if collection:
|
||||
if collection in self.client[db_name_out].list_collection_names():
|
||||
if collection in self.client[db_name_out].list_collection_names(): # noqa
|
||||
self.client[db_name_out][collection].drop()
|
||||
else:
|
||||
self.teardown(db_name_out)
|
||||
|
|
@ -132,7 +132,11 @@ class DBHandler:
|
|||
db_name=db_name, db_name_out=db_name_out,
|
||||
collection=collection)
|
||||
print("mongorestore query:: {}".format(query))
|
||||
subprocess.run(query)
|
||||
try:
|
||||
subprocess.run(query)
|
||||
except FileNotFoundError:
|
||||
raise RuntimeError("'mongorestore' utility must be on path."
|
||||
"Please install it.")
|
||||
|
||||
def teardown(self, db_name):
|
||||
"""Drops 'db_name' if exists."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue