mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #1407 from pypeclub/feature/validate_mongo_db_on_start
This commit is contained in:
commit
191dfb8eec
1 changed files with 26 additions and 11 deletions
37
start.py
37
start.py
|
|
@ -124,7 +124,10 @@ else:
|
|||
|
||||
import igniter # noqa: E402
|
||||
from igniter import BootstrapRepos # noqa: E402
|
||||
from igniter.tools import get_openpype_path_from_db # noqa
|
||||
from igniter.tools import (
|
||||
get_openpype_path_from_db,
|
||||
validate_mongo_connection
|
||||
) # noqa
|
||||
from igniter.bootstrap_repos import OpenPypeVersion # noqa: E402
|
||||
|
||||
bootstrap = BootstrapRepos()
|
||||
|
|
@ -306,20 +309,32 @@ def _determine_mongodb() -> str:
|
|||
openpype_mongo = os.getenv("OPENPYPE_MONGO", None)
|
||||
if not openpype_mongo:
|
||||
# try system keyring
|
||||
try:
|
||||
openpype_mongo = bootstrap.secure_registry.get_item(
|
||||
"openPypeMongo"
|
||||
)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if openpype_mongo:
|
||||
result, msg = validate_mongo_connection(openpype_mongo)
|
||||
if not result:
|
||||
print(msg)
|
||||
openpype_mongo = None
|
||||
|
||||
if not openpype_mongo:
|
||||
print("*** No DB connection string specified.")
|
||||
print("--- launching setup UI ...")
|
||||
|
||||
result = igniter.open_dialog()
|
||||
if result == 0:
|
||||
raise RuntimeError("MongoDB URL was not defined")
|
||||
|
||||
try:
|
||||
openpype_mongo = bootstrap.secure_registry.get_item(
|
||||
"openPypeMongo")
|
||||
except ValueError:
|
||||
print("*** No DB connection string specified.")
|
||||
print("--- launching setup UI ...")
|
||||
import igniter
|
||||
igniter.open_dialog()
|
||||
|
||||
try:
|
||||
openpype_mongo = bootstrap.secure_registry.get_item(
|
||||
"openPypeMongo")
|
||||
except ValueError:
|
||||
raise RuntimeError("missing mongodb url")
|
||||
raise RuntimeError("Missing MongoDB url")
|
||||
|
||||
return openpype_mongo
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue