Installing stable/ocata using expand/migrate/contract for the first time raises TypeError

Bug #1726237 reported by Tushar Patil
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Unassigned

Bug Description

If you are installing stable/ocata branch for the first time using the latest zero-down time database upgrade method, then it gives following error when you run "db migrate" command.

$glance-manage db migrate

Output:
2017-10-19 02:31:26.550 CRITICAL glance [-] TypeError: 'function' object has no attribute '__getitem__'
   2017-10-19 02:31:26.550 TRACE glance Traceback (most recent call last):
   2017-10-19 02:31:26.550 TRACE glance File "./glance-manage", line 10, in <module>
   2017-10-19 02:31:26.550 TRACE glance sys.exit(main())
   2017-10-19 02:31:26.550 TRACE glance File "/opt/stack/glance/glance/cmd/manage.py", line 460, in main
   2017-10-19 02:31:26.550 TRACE glance return CONF.command.action_fn(*func_args, **func_kwargs)
   2017-10-19 02:31:26.550 TRACE glance File "/opt/stack/glance/glance/cmd/manage.py", line 175, in contract
   2017-10-19 02:31:26.550 TRACE glance if data_migrations.has_pending_migrations(db_api.get_engine()):
   2017-10-19 02:31:26.550 TRACE glance File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/data_migrations/__init__.py", line 61, in has_pending_migrations
   2017-10-19 02:31:26.550 TRACE glance return any([x.has_migrations(engine) for x in migrations])
   2017-10-19 02:31:26.550 TRACE glance File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/data_migrations/ocata_migrate01_community_images.py", line 43, in has_migrations
   2017-10-19 02:31:26.550 TRACE glance rows_with_pending_shared = (select[images.c.id]
   2017-10-19 02:31:26.550 TRACE glance TypeError: 'function' object has no attribute '__getitem__'
   2017-10-19 02:31:26.550 TRACE glance

Reason: https://github.com/openstack/glance/blob/stable/ocata/glance/db/sqlalchemy/alembic_migrations/data_migrations/ocata_migrate01_community_images.py#L43
Actual line: rows_with_pending_shared = (select[images.c.id]
Expected line: rows_with_pending_shared = (select([images.c.id])

Steps to reproduce:
1. Clone glance stable/ocata branch.
2. CREATE DATABASE glance CHARACTER SET utf8;
3. glance-manage db expand
4. glance-manage db migrate

Revision history for this message
Abhishek Kekane (abhishek-kekane) wrote :

A patch to fix this issue is already up for ocata branch but it is abandon now.
Please refer, https://review.openstack.org/#/c/440876/6

If we could restore this patch then there is no need to submit the new patch to fix this issue. Otherwise we need to submit a new patch directly to stable/ocata branch.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.