Remove spurious sys.exits
This removes sys.exits which are never called and moves one try-except block to the lines in which the exception is actually raised. Change-Id: Idb5bde84136208dc39d877b4b66b39a433d85375
This commit is contained in:
parent
53c5679b17
commit
80c6e725bc
@ -53,7 +53,6 @@ else:
|
||||
|
||||
# Get the connection string for the service db
|
||||
if "OPENSTACK_CONFIG_FILE" in os.environ:
|
||||
try:
|
||||
os_conf = os.environ['OPENSTACK_CONFIG_FILE']
|
||||
if "OPENSTACK_CONFIG_DB_SECTION" in os.environ:
|
||||
os_conf_section = os.environ['OPENSTACK_CONFIG_DB_SECTION']
|
||||
@ -65,6 +64,7 @@ if "OPENSTACK_CONFIG_FILE" in os.environ:
|
||||
else:
|
||||
logger.critical('environment variable OPENSTACK_CONFIG_DB_KEY not set')
|
||||
sys.exit(1)
|
||||
try:
|
||||
config = ConfigParser.RawConfigParser()
|
||||
logger.info("Using {0} as db config source".format(os_conf))
|
||||
config.read(os_conf)
|
||||
@ -74,7 +74,7 @@ if "OPENSTACK_CONFIG_FILE" in os.environ:
|
||||
logger.info("Got config from {0}".format(os_conf))
|
||||
except:
|
||||
logger.critical("Tried to load config from {0} but failed.".format(os_conf))
|
||||
sys.exit(1)
|
||||
raise
|
||||
elif "DB_CONNECTION" in os.environ:
|
||||
user_db_conn = os.environ['DB_CONNECTION']
|
||||
logger.info('Got config from DB_CONNECTION env var')
|
||||
@ -99,7 +99,6 @@ try:
|
||||
except:
|
||||
logger.critical('Could not connect to database as root user')
|
||||
raise
|
||||
sys.exit(1)
|
||||
|
||||
# User DB engine
|
||||
try:
|
||||
@ -112,7 +111,6 @@ try:
|
||||
except:
|
||||
logger.critical('Could not get user database config')
|
||||
raise
|
||||
sys.exit(1)
|
||||
|
||||
# Create DB
|
||||
try:
|
||||
@ -121,7 +119,6 @@ try:
|
||||
except:
|
||||
logger.critical("Could not create database {0}".format(database))
|
||||
raise
|
||||
sys.exit(1)
|
||||
|
||||
# Create DB User
|
||||
try:
|
||||
@ -132,7 +129,6 @@ try:
|
||||
except:
|
||||
logger.critical("Could not create user {0} for {1}".format(user, database))
|
||||
raise
|
||||
sys.exit(1)
|
||||
|
||||
# Test connection
|
||||
try:
|
||||
@ -143,7 +139,6 @@ try:
|
||||
except:
|
||||
logger.critical('Could not connect to database as user')
|
||||
raise
|
||||
sys.exit(1)
|
||||
|
||||
logger.info('Finished DB Management')
|
||||
{{- end }}
|
||||
|
Loading…
Reference in New Issue
Block a user