Merge pull request #325 from TheophileDiot/1.5

Fix db init with autoconf
This commit is contained in:
Théophile Diot 2022-10-20 15:57:23 +02:00 committed by GitHub
commit 1008490234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View File

@ -186,7 +186,7 @@ if __name__ == "__main__":
bw_integration = f.read().strip()
db = None
if "DATABASE_URI" in config_files or bw_integration == "Linux":
if bw_integration == "Linux":
db = Database(logger, config_files["DATABASE_URI"])
elif bw_integration in ("Docker", "Swarm", "Autoconf"):
try:

View File

@ -151,21 +151,19 @@ if __name__ == "__main__":
logger.error("No database found, exiting ...")
stop(1)
if not db.is_initialized():
logger.info(
"Database is not initialized, waiting ...",
while not db.is_initialized():
logger.warning(
"Database is not initialized, retrying in 5s ...",
)
while not db.is_initialized():
sleep(3)
sleep(3)
env = db.get_config()
if not db.is_first_config_saved() or not env:
while not db.is_first_config_saved() or not env:
logger.info(
"Database doesn't have any config saved yet, waiting ...",
"Database doesn't have any config saved yet, retrying in 5s ...",
)
while not db.is_first_config_saved() or not env:
sleep(3)
env = db.get_config()
sleep(3)
env = db.get_config()
if args.run:
# write config to /tmp/variables.env