Added check for database readiness before starting daemons

Fixes the issue where our logs get spammed with errors before we have
things setup.

Change-Id: I7e6b90832b7d6fb601c64b81c6f4e6afc5e956b6
This commit is contained in:
Pete Vander Giessen 2019-09-27 18:21:29 -04:00
parent 38686c176c
commit f612dd2e61
1 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@
import logging
import os
import subprocess
import sys
from snap_openstack.base import OpenStackSnap
@ -45,6 +46,12 @@ def main():
sys.exit(0)
if sys.argv[1] == 'launch':
database_ready = subprocess.check_output(
['snapctl', 'get', 'database.ready']).decode('utf-8').strip()
if not database_ready.lower() == 'true':
LOG.info("Database backend access not yet setup. Exiting.")
sys.exit(0)
s_openstack.launch(sys.argv)
sys.exit(0)