Bug 964981 - HTTP 500 when passing "enabled":"true" to keystone
HTTP 500 when passing "enabled":"true" to keystone
Status: CLOSED ERRATA
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-keystone (Show other bugs)
3.0
x86_64 Linux
low Severity medium
: beta
: 4.0
Assigned To: Adam Young
Jeremy Agee
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-20 04:56 EDT by Jaroslav Henner
Modified: 2016-04-26 11:08 EDT (History)
7 users (show)

See Also:
Fixed In Version: 2013.2-0.11.b3
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-19 19:02:51 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1110435 None None None Never

  None (edit)
Description Jaroslav Henner 2013-05-20 04:56:50 EDT
Description of problem:
$subj

Version-Release number of selected component (if applicable):
openstack-keystone-2013.1.1-1.el6ost.noarch

How reproducible:
100%

Steps to Reproduce:
1. 
url -i http://KEYSTONE:35357/v2.0/tenants -X POST -H 'content-type: application/json' -H "Accept: application/json" -H "X-Auth-Token: c27d9ef2b9ef4313ba553c7885cbe86c" --data '{"tenant": {"enabled": "true", "name": "TestServerDiskConfig201853-tenant", "description": "TestServerDiskConfig201853-tenant-desc"}}'         
HTTP/1.1 500 Internal Server Error
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 578
Date: Mon, 20 May 2013 08:40:31 GMT

{"error": {"message": "An unexpected error prevented the server from fulfilling your request. invalid literal for int() with base 10: 'true' (original cause: ValueError: invalid literal for int() with base 10: 'true') 'INSERT INTO project (id, name, domain_id, description, enabled, extra) VALUES (%s, %s, %s, %s, %s, %s)' [{'description': u'TestServerDiskConfig201853-tenant-desc', 'extra': {}, 'enabled': u'true', 'id': 'b8c848f5fa7c4e87b15693e4b501d310', 'domain_id': 'default', 'name': u'TestServerDiskConfig201853-tenant'}]", "code": 500, "title": "Internal Server Error"}}%       


Actual results:
HTTP 500

Expected results:
HTTP 4xx

Additional info:
2013-05-20 08:56:06    ERROR [root] invalid literal for int() with base 10: 'true' (original cause: ValueError: invalid literal for int() with base 10: 'true') 'INSERT INTO project (id, name, domain_id, description, enabled, extra) VALUES (%s, %s, %s, %s, %s, %s)' [{'description': u'TestServerDiskConfig201853-tenant-desc', 'extra': {}, 'enabled': u'true', 'id': 'c7f774f26c144d0fb2246b3a54f933db', 'domain_id': 'default', 'name': u'TestServerDiskConfig201853-tenant'}]
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/keystone/common/wsgi.py", line 236, in __call__
    result = method(context, **params)
  File "/usr/lib/python2.6/site-packages/keystone/identity/controllers.py", line 105, in create_project
    self._normalize_domain_id(context, tenant_ref))
  File "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 83, in create_project
    return self.driver.create_project(tenant_id, tenant)
  File "/usr/lib/python2.6/site-packages/keystone/common/sql/core.py", line 272, in wrapper
    return method(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/keystone/identity/backends/sql.py", line 451, in create_project
    session.flush()
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/session.py", line 1583, in flush
    self._flush(objects)
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/session.py", line 1654, in _flush
    flush_context.execute()
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/unitofwork.py", line 331, in execute
    rec.execute(self)
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/unitofwork.py", line 475, in execute
    uow
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/persistence.py", line 64, in save_obj
    table, insert)
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/persistence.py", line 530, in _emit_insert_statements
    execute(statement, multiparams)
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1449, in execute
    params)
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1584, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1651, in _execute_context
    None, None)
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1647, in _execute_context
    context = constructor(dialect, self, conn, *args)
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/default.py", line 463, in _init_compiled
    param.append(processors[key](compiled_params[key]))
  File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/processors.py", line 42, in boolean_to_int
    return int(value)
StatementError: invalid literal for int() with base 10: 'true' (original cause: ValueError: invalid literal for int() with base 10: 'true') 'INSERT INTO project (id, name, domain_id, description, enabled, extra) VALUES (%s, %s, %s, %s, %s, %s)' [{'description': u'TestServerDiskConfig201853-tenant-desc', 'extra': {}, 'enabled': u'true', 'id': 'c7f774f26c144d0fb2246b3a54f933db', 'domain_id': 'default', 'name': u'TestServerDiskConfig201853-tenant'}]
Comment 2 Alan Pevec 2013-05-22 14:30:30 EDT
Works with "enabled": true as documented in http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_addTenant_v2.0_tenants_Admin_API_Service_Developer_Operations-d1e1356.html


$ curl -i http://localhost:35357/v2.0/tenants t-type: application/json' -H "Accept: application/json" -H "X-Auth-Token: d55a0d7fca2f47189b199f0c06af2bce" --data '{"tenant": {"enabled": true, "name": "TestServerDiskConfig201853-tenant", "description": "TestServerDiskConfig201853-tenant-desc"}}'
HTTP/1.1 200 OK
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 173
Date: Wed, 22 May 2013 18:27:41 GMT

{"tenant": {"description": "TestServerDiskConfig201853-tenant-desc", "enabled": true, "id": "10ac412c38664cd2b425df289ce41c28", "name": "TestServerDiskConfig201853-tenant"}}
Comment 4 Adam Young 2013-05-31 15:47:33 EDT
Please file an upstream bug and link.
Comment 5 Jaroslav Henner 2013-06-06 05:46:10 EDT
Seems like it was fixed in Havana.
Comment 6 Scott Lewis 2013-11-19 11:54:39 EST
Auto adding >= MODIFIED bugs to beta
Comment 7 Jeremy Agee 2013-12-17 13:10:29 EST
when "enabled": "true" or "enabled": "false" are submitted.

curl -X POST http://localhost:35357/v2.0/tenants -H "content-type: application/json" -H "X-Auth-Token:$TEST_TOKEN" --data '{"tenant": {"enabled": "true", "name": "project", "description": "new project description"}}'

Keystone now report:
{"error": {"message": "Project enabled is not a boolean", "code": 400, "title": "Bad Request"}}


Documented method still functions as expected.

curl -X POST http://localhost:35357/v2.0/tenants -H "content-type: application/json" -H "X-Auth-Token:$TEST_TOKEN" --data '{"tenant": {"enabled": true, "name": "myproject1", "description": "new myproject1"}}'

{"tenant": {"description": "new myproject1", "enabled": true, "id": "31a977aa9982408d942901ed13d1c31c", "name": "myproject1"}}

curl -X POST http://localhost:35357/v2.0/tenants -H "content-type: application/json" -H "X-Auth-Token:$TEST_TOKEN" --data '{"tenant": {"enabled": false, "name": "myproject2", "description": "new myproject2"}}'

{"tenant": {"description": "new myproject2", "enabled": false, "id": "19657c0555b74004a8bc28b7f95000df", "name": "myproject2"}}
Comment 9 errata-xmlrpc 2013-12-19 19:02:51 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1859.html

Note You need to log in before you can comment on or make changes to this bug.