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 appVersion: v1.0.0
description: OpenStack-Helm Keystone description: OpenStack-Helm Keystone
name: keystone name: keystone
version: 0.3.13 version: 0.3.14
home: https://docs.openstack.org/keystone/latest/ home: https://docs.openstack.org/keystone/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png
sources: sources:

View File

@ -128,7 +128,12 @@ except:
try: try:
cmd = "DELETE FROM credential" 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') logger.info('Deleted all entries in credential table')
except: except:
logger.critical('Failed to clean up credential table in keystone db') 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_id = (select id from service where "
"service.type = 'identity') and " "service.type = 'identity') and "
"region_id = %s") "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: except:
logger.critical("Could not update internal endpoint") logger.critical("Could not update internal endpoint")
raise raise
@ -86,7 +91,12 @@ try:
"and service_id = (select id from service where " "and service_id = (select id from service where "
"service.type = 'identity') " "service.type = 'identity') "
"and region_id = %s") "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: except:
logger.critical("Could not update admin endpoint") logger.critical("Could not update admin endpoint")
raise raise
@ -99,17 +109,23 @@ try:
"and service_id = (select id from service where " "and service_id = (select id from service where "
"service.type = 'identity') " "service.type = 'identity') "
"and region_id = %s") "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: except:
logger.critical("Could not update public endpoint") logger.critical("Could not update public endpoint")
raise raise
# Print endpoints # Print endpoints
try: try:
endpoints = user_engine.execute( with user_engine.connect() as connection:
("select interface, url from endpoint where service_id = " endpoints = connection.execute(
"(select id from service where service.type = 'identity')") ("select interface, url from endpoint where service_id = "
).fetchall() "(select id from service where service.type = 'identity')")
).fetchall()
for row in endpoints: for row in endpoints:
logger.info("endpoint ({0}): {1}".format(row[0], row[1])) logger.info("endpoint ({0}): {1}".format(row[0], row[1]))
except: except:

View File

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