Align db scripts with sqlalchemy 2.0

Change-Id: Icb8085fabc6661226b0d8e3fdc7ed7d3afa478be
This commit is contained in:
Vladimir Kozhukalov 2024-07-10 10:18:11 -05:00
parent 295beb3d0c
commit dcb30a5ebe
4 changed files with 31 additions and 9 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Keystone
name: keystone
version: 0.3.13
version: 0.3.14
home: https://docs.openstack.org/keystone/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png
sources:

View File

@ -128,7 +128,12 @@ except:
try:
cmd = "DELETE FROM credential"
user_engine.execute(cmd)
with user_engine.connect() as connection:
connection.execute(cmd)
try:
connection.commit()
except AttributeError:
pass
logger.info('Deleted all entries in credential table')
except:
logger.critical('Failed to clean up credential table in keystone db')

View File

@ -73,7 +73,12 @@ try:
"service_id = (select id from service where "
"service.type = 'identity') and "
"region_id = %s")
user_engine.execute(cmd, (endpoint_url,region_id))
with user_engine.connect() as connection:
connection.execute(cmd, (endpoint_url,region_id))
try:
connection.commit()
except AttributeError:
pass
except:
logger.critical("Could not update internal endpoint")
raise
@ -86,7 +91,12 @@ try:
"and service_id = (select id from service where "
"service.type = 'identity') "
"and region_id = %s")
user_engine.execute(cmd, (endpoint_url,region_id))
with user_engine.connect() as connection:
connection.execute(cmd, (endpoint_url,region_id))
try:
connection.commit()
except AttributeError:
pass
except:
logger.critical("Could not update admin endpoint")
raise
@ -99,14 +109,20 @@ try:
"and service_id = (select id from service where "
"service.type = 'identity') "
"and region_id = %s")
user_engine.execute(cmd, (endpoint_url,region_id))
with user_engine.connect() as connection:
connection.execute(cmd, (endpoint_url,region_id))
try:
connection.commit()
except AttributeError:
pass
except:
logger.critical("Could not update public endpoint")
raise
# Print endpoints
try:
endpoints = user_engine.execute(
with user_engine.connect() as connection:
endpoints = connection.execute(
("select interface, url from endpoint where service_id = "
"(select id from service where service.type = 'identity')")
).fetchall()

View File

@ -60,4 +60,5 @@ keystone:
- 0.3.11 Fix custom annotations when helm3_hook is disabled
- 0.3.12 Enable custom annotations for Openstack secrets
- 0.3.13 Update images used by default
- 0.3.14 Align db scripts with sqlalchemy 2.0
...