From 397edf53c161e9dbc9b26ab152227142d8c38796 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 10 Nov 2023 15:17:52 +0100 Subject: [PATCH] Use alembic alter_column for 35cb52c5553f migration With latest sqlalchemy there is no alter attribute for the Column object Thus, zun-db-manage upgrade fails with AttributeError. Instead of trying to use SQLAlchemy for altering Column we should use alembic instead for the migration This also fix py3.11 job by replacing libmysqlclient-dev with libmariadb-dev-compat which is available for both ubuntu and debian. Closes-Bug: #2043209 Change-Id: Iaba736d391ad5820de5f481d2c5bac1714dc0809 --- bindep.txt | 10 +++++----- zun/api/controllers/v1/schemas/parameter_types.py | 3 +-- ...2c5553f_rename_volume_id_to_cinder_volume_id_in_.py | 9 +++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bindep.txt b/bindep.txt index 5b7fe8148..630617071 100644 --- a/bindep.txt +++ b/bindep.txt @@ -14,11 +14,11 @@ numactl # MySQL and PostgreSQL databases since some jobs are set up in # OpenStack infra that need these like -libmysqlclient-dev [platform:dpkg test] -mysql [platform:rpm test] -mysql-client [platform:dpkg test] -mysql-devel [platform:rpm test] -mysql-server [test] +libmariadb-dev-compat [platform:dpkg test] +mariadb [platform:rpm test] +mariadb-client [platform:dpkg test] +mariadb-devel [platform:rpm test] +mariadb-server [test] postgresql [test] postgresql-client [platform:dpkg test] postgresql-devel [platform:rpm test] diff --git a/zun/api/controllers/v1/schemas/parameter_types.py b/zun/api/controllers/v1/schemas/parameter_types.py index 8b8a09f0f..7c2845d79 100644 --- a/zun/api/controllers/v1/schemas/parameter_types.py +++ b/zun/api/controllers/v1/schemas/parameter_types.py @@ -331,9 +331,8 @@ hostname = { SIGNALS = ['None'] if sys.version_info >= (3, 5, 0): - signals = [n for n in signal.Signals] + signals = [n.name for n in signal.Signals] for s in signals: - s = str(s).split('.')[1] SIGNALS.append(s) SIGNALS.append(s.replace('SIG', '')) SIGNALS.append(s.lower()) diff --git a/zun/db/sqlalchemy/alembic/versions/35cb52c5553f_rename_volume_id_to_cinder_volume_id_in_.py b/zun/db/sqlalchemy/alembic/versions/35cb52c5553f_rename_volume_id_to_cinder_volume_id_in_.py index cd13d6190..8155a934b 100644 --- a/zun/db/sqlalchemy/alembic/versions/35cb52c5553f_rename_volume_id_to_cinder_volume_id_in_.py +++ b/zun/db/sqlalchemy/alembic/versions/35cb52c5553f_rename_volume_id_to_cinder_volume_id_in_.py @@ -29,7 +29,8 @@ import sqlalchemy as sa def upgrade(): - volume_mapping_table = sa.Table( - "volume_mapping", sa.MetaData(bind=op.get_bind()), - sa.Column('volume_id', sa.String(36), nullable=True)) - volume_mapping_table.c.volume_id.alter(name='cinder_volume_id') + op.alter_column( + 'volume_mapping', 'volume_id', + new_column_name='cinder_volume_id', + type_=sa.String(36) + )