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() bw_integration = f.read().strip()
db = None db = None
if "DATABASE_URI" in config_files or bw_integration == "Linux": if bw_integration == "Linux":
db = Database(logger, config_files["DATABASE_URI"]) db = Database(logger, config_files["DATABASE_URI"])
elif bw_integration in ("Docker", "Swarm", "Autoconf"): elif bw_integration in ("Docker", "Swarm", "Autoconf"):
try: try:

View file

@ -151,21 +151,19 @@ if __name__ == "__main__":
logger.error("No database found, exiting ...") logger.error("No database found, exiting ...")
stop(1) stop(1)
if not db.is_initialized(): while not db.is_initialized():
logger.info( logger.warning(
"Database is not initialized, waiting ...", "Database is not initialized, retrying in 5s ...",
) )
while not db.is_initialized(): sleep(3)
sleep(3)
env = db.get_config() 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( 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)
sleep(3) env = db.get_config()
env = db.get_config()
if args.run: if args.run:
# write config to /tmp/variables.env # write config to /tmp/variables.env