← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1191384] Re: 400 Bad Request not raised for string values of 'enabled' when update a tenant

 

** Changed in: keystone
       Status: Fix Committed => Fix Released

** Changed in: keystone
    Milestone: None => havana-2

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

Title:
  400 Bad Request not raised for string values of 'enabled'  when update
  a tenant

Status in OpenStack Identity (Keystone):
  Fix Released

Bug description:
  When update a tenant with string value of 'enable', 500 Internal
  Server Error raised, which should be 400 Bad Request.

  Reproduce Step:
  trystack@Key31:~$ curl -s -H 'Content-Type: application/json' -d '{"tenant":{"name":"test2","description":"","enabled": "true"}}' -H 'X-Auth-Token: ADMIN_TOKEN' -X POST http://localhost:35357/v2.0/tenants/7d037c0b18d34a6b9f94f2a76fad19a4 | python -mjson.tool
  {
      "error": {
          "code": 500, 
          "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') 'UPDATE project SET enabled=%s WHERE project.id = %s' [{u'project_id': u'7d037c0b18d34a6b9f94f2a76fad19a4', 'enabled': u'true'}]", 
          "title": "Internal Server Error"
      }
  }

  Log:
  2013-06-16 03:00:43    ERROR [keystone.common.wsgi] invalid literal for int() with base 10: 'true' (original cause: ValueError: invalid literal for int() with base 10: 'true') 'UPDATE project SET enabled=%s WHERE project.id = %s' [{u'project_id': u'7d037c0b18d34a6b9f94f2a76fad19a4', 'enabled': u'true'}]
  Traceback (most recent call last):
    File "/home/trystack/src/keystone/keystone/common/wsgi.py", line 183, in __call__
      result = method(context, **params)
    File "/home/trystack/src/keystone/keystone/identity/controllers.py", line 115, in update_project
      context, tenant_id, clean_tenant)
    File "/home/trystack/src/keystone/keystone/common/manager.py", line 47, in _wrapper
      return f(*args, **kw)
    File "/home/trystack/src/keystone/keystone/common/sql/core.py", line 273, in wrapper
      return method(*args, **kwargs)
    File "/home/trystack/src/keystone/keystone/identity/backends/sql.py", line 470, in update_project
      session.flush()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1718, in flush
      self._flush(objects)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1789, in _flush
      flush_context.execute()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 331, in execute
      rec.execute(self)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 475, in execute
      uow
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 59, in save_obj
      mapper, table, update)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 485, in _emit_update_statements
      execute(statement, params)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1449, in execute
      params)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1584, in _execute_clauseelement
      compiled_sql, distilled_params
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1651, in _execute_context
      None, None)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1647, in _execute_context
      context = constructor(dialect, self, conn, *args)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 463, in _init_compiled
      param.append(processors[key](compiled_params[key]))
    File "/usr/local/lib/python2.7/dist-packages/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') 'UPDATE project SET enabled=%s WHERE project.id = %s' [{u'project_id': u'7d037c0b18d34a6b9f94f2a76fad19a4', 'enabled': u'true'}]

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