← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1726237] [NEW] Installing stable/ocata using expand/migrate/contract for the first time raises TypeError

 

Public bug reported:

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

** Affects: glance
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1726237

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

Status in Glance:
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1726237/+subscriptions