Align db scripts with sqlalchemy 2.0
Change-Id: I0b6c500e8257c333c16c15d7d338651ee5b2ca27
This commit is contained in:
parent
01e66933b3
commit
f803daeb5e
@ -15,7 +15,7 @@ apiVersion: v1
|
|||||||
appVersion: v1.0.0
|
appVersion: v1.0.0
|
||||||
description: OpenStack-Helm Helm-Toolkit
|
description: OpenStack-Helm Helm-Toolkit
|
||||||
name: helm-toolkit
|
name: helm-toolkit
|
||||||
version: 0.2.65
|
version: 0.2.66
|
||||||
home: https://docs.openstack.org/openstack-helm
|
home: https://docs.openstack.org/openstack-helm
|
||||||
icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png
|
icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png
|
||||||
sources:
|
sources:
|
||||||
|
@ -124,7 +124,12 @@ except:
|
|||||||
|
|
||||||
# Delete DB
|
# Delete DB
|
||||||
try:
|
try:
|
||||||
root_engine.execute("DROP DATABASE IF EXISTS {0}".format(database))
|
with root_engine.connect() as connection:
|
||||||
|
connection.execute("DROP DATABASE IF EXISTS {0}".format(database))
|
||||||
|
try:
|
||||||
|
connection.commit()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
logger.info("Deleted database {0}".format(database))
|
logger.info("Deleted database {0}".format(database))
|
||||||
except:
|
except:
|
||||||
logger.critical("Could not drop database {0}".format(database))
|
logger.critical("Could not drop database {0}".format(database))
|
||||||
@ -132,7 +137,12 @@ except:
|
|||||||
|
|
||||||
# Delete DB User
|
# Delete DB User
|
||||||
try:
|
try:
|
||||||
root_engine.execute("DROP USER IF EXISTS {0}".format(user))
|
with root_engine.connect() as connection:
|
||||||
|
connection.execute("DROP USER IF EXISTS {0}".format(user))
|
||||||
|
try:
|
||||||
|
connection.commit()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
logger.info("Deleted user {0}".format(user))
|
logger.info("Deleted user {0}".format(user))
|
||||||
except:
|
except:
|
||||||
logger.critical("Could not delete user {0}".format(user))
|
logger.critical("Could not delete user {0}".format(user))
|
||||||
|
@ -124,7 +124,12 @@ except:
|
|||||||
|
|
||||||
# Create DB
|
# Create DB
|
||||||
try:
|
try:
|
||||||
root_engine.execute("CREATE DATABASE IF NOT EXISTS {0}".format(database))
|
with root_engine.connect() as connection:
|
||||||
|
connection.execute("CREATE DATABASE IF NOT EXISTS {0}".format(database))
|
||||||
|
try:
|
||||||
|
connection.commit()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
logger.info("Created database {0}".format(database))
|
logger.info("Created database {0}".format(database))
|
||||||
except:
|
except:
|
||||||
logger.critical("Could not create database {0}".format(database))
|
logger.critical("Could not create database {0}".format(database))
|
||||||
@ -132,11 +137,16 @@ except:
|
|||||||
|
|
||||||
# Create DB User
|
# Create DB User
|
||||||
try:
|
try:
|
||||||
root_engine.execute(
|
with root_engine.connect() as connection:
|
||||||
|
connection.execute(
|
||||||
"CREATE USER IF NOT EXISTS \'{0}\'@\'%%\' IDENTIFIED BY \'{1}\' {2}".format(
|
"CREATE USER IF NOT EXISTS \'{0}\'@\'%%\' IDENTIFIED BY \'{1}\' {2}".format(
|
||||||
user, password, mysql_x509))
|
user, password, mysql_x509))
|
||||||
root_engine.execute(
|
connection.execute(
|
||||||
"GRANT ALL ON `{0}`.* TO \'{1}\'@\'%%\'".format(database, user))
|
"GRANT ALL ON `{0}`.* TO \'{1}\'@\'%%\'".format(database, user))
|
||||||
|
try:
|
||||||
|
connection.commit()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
logger.info("Created user {0} for {1}".format(user, database))
|
logger.info("Created user {0} for {1}".format(user, database))
|
||||||
except:
|
except:
|
||||||
logger.critical("Could not create user {0} for {1}".format(user, database))
|
logger.critical("Could not create user {0} for {1}".format(user, database))
|
||||||
|
@ -72,4 +72,5 @@ helm-toolkit:
|
|||||||
- 0.2.63 Add custom job annotations snippet and wire it into job templates
|
- 0.2.63 Add custom job annotations snippet and wire it into job templates
|
||||||
- 0.2.64 Use custom secret annotations snippet in other secret templates
|
- 0.2.64 Use custom secret annotations snippet in other secret templates
|
||||||
- 0.2.65 Escape special characters in password for DB connection
|
- 0.2.65 Escape special characters in password for DB connection
|
||||||
|
- 0.2.66 Align db scripts with sqlalchemy 2.0
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user