type error with postgresql

Bug #885426 reported by Patrick Hetu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Core Infrastructure
Fix Released
Medium
Unassigned
OpenStack Identity (keystone)
Fix Released
Medium
Dolph Mathews

Bug Description

root@os:~# dpkg -l | grep keystone
ii keystone 1.0~d4~20110909.1108-0ubuntu3 Proposed OpenStack identity service - Daemons
ii python-keystone 1.0~d4~20110909.1108-0ubuntu3 Proposed OpenStack identity service - Python library

I have changed the backend to be postgresql instead of sqlite like this:

  sql_connection = postgresql://keystone:password@localhost:5432/keystone

But I get this error when I try to add a new tenant:

root@os:~# keystone-manage tenant add admin
ERROR: Failed to create tenant admin: (<class 'sqlalchemy.exc.ProgrammingError'>, ProgrammingError('(ProgrammingError) column "enabled" is of type integer but expression is of type boolean\nLINE 1: ...O tenants (id, "desc", enabled) VALUES (\'admin\', NULL, true)\n ^\nHINT: You will need to rewrite or cast the expression.\n',), <traceback object at 0x2573d88>)

Don't hesitate to ask me if you need more details.

Revision history for this message
Patrick Hetu (patrick-hetu) wrote :

FYI, I fixed the bug this way:

sudo -u postgres psql keystone
  keystone=# ALTER TABLE tenants add COLUMN enabled2 boolean;
  ALTER TABLE
  keystone=# ALTER TABLE tenants RENAME enabled TO enabled3;
  ALTER TABLE
  keystone=# ALTER TABLE tenants RENAME enabled2 TO enabled;
  ALTER TABLE
  keystone=# \q

Revision history for this message
Patrick Hetu (patrick-hetu) wrote :

In keystone/manage/api.py:

      obj.enabled = True

needs to be:

    obj.enabled = 1

Because the enable column is a interger in the database.

Revision history for this message
Ziad Sawalha (ziad-sawalha) wrote :

Unfortunately, in sqlalchemy we have:

    enabled = Column(Integer)

for Users and Tenants, but

    enabled = Column(Boolean)
    is_global = Column(Boolean)

for EndpointTemplates.

We need to handle these differently and as Patrick points above, use the correct types.

Will also talk to the CI team about how we can get postgres testing included.

Revision history for this message
Ziad Sawalha (ziad-sawalha) wrote :

What we can do by Essex-3 is try to fix the sqlalchemy backend.

The CI testing against postgres might take longer...

Changed in keystone:
milestone: none → essex-3
assignee: nobody → Rackspace Integration (rackspace-integration)
status: New → Confirmed
Revision history for this message
Monty Taylor (mordred) wrote :

I'm going to add an entry for CI testing here - I definitely think that enabled should be Column(Boolean) instead.

Changed in openstack-ci:
status: New → Triaged
importance: Undecided → Medium
Joe Savak (jsavak)
Changed in keystone:
assignee: Rackspace Integration (rackspace-integration) → Dolph Mathews (dolph)
Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Medium
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/3374

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/3374
Committed: http://github.com/openstack/keystone/commit/b1581a1852142548814d72deb0eebee238b4fdbf
Submitter: Jenkins
Branch: master

commit b1581a1852142548814d72deb0eebee238b4fdbf
Author: Dolph Mathews <email address hidden>
Date: Mon Jan 23 11:02:01 2012 -0600

    Migrated 'enabled' int columns to bool for postgres (bug 885426)

    Also included additional fixes for bp portable-identifiers
    which were discovered by running existing tests against
    postgres, per the bug referenced above.

    Change-Id: I6c51bb817ec12df33866ff632f906d17c90c8d54

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (milestone-proposed)

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/3403

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (milestone-proposed)

Reviewed: https://review.openstack.org/3403
Committed: http://github.com/openstack/keystone/commit/4e38cd6a96cae1bb3cf3cbfbf0ff3be7e6428af9
Submitter: Jenkins
Branch: milestone-proposed

commit 4e38cd6a96cae1bb3cf3cbfbf0ff3be7e6428af9
Author: Dolph Mathews <email address hidden>
Date: Wed Jan 25 08:38:27 2012 -0600

    Forgot to update models (bug 885426)

    Change-Id: Ic3ed3491839502e904a20a31b1032c941b008fba

Thierry Carrez (ttx)
Changed in keystone:
milestone: essex-3 → 2012.1
Revision history for this message
Clark Boylan (cboylan) wrote :

The CI "unittest" nodes now provide both mysql and postgres servers for testing against. The openstack_citest DB user has access to a schema called openstack_citest against which DB testing can happen. Nova and others are using this to test DB migrations.

In addition to unittest nodes providing access to postgres we now have a postgres tempest job. It can be found at https://jenkins.openstack.org/job/gate-tempest-devstack-vm-postgres-full/. Note this test may not pass but the ability to test with postgres is there.

Changed in openstack-ci:
status: Triaged → Fix Released
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.