Reviewed: https://review.openstack.org/246781 Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=9d18672c7f99d8cb6285ac689f5b75f1c961fedd Submitter: Jenkins Branch: master
commit 9d18672c7f99d8cb6285ac689f5b75f1c961fedd Author: shihanzhang <[email protected]> Date: Wed Nov 18 15:07:43 2015 +0800 Check target_tenant when create rbac policy Currently the default value of target_tenant in rbac_policies resource is None, if a user creates rbac policy without a target_tenant, neutron-server raises an internal error. This patch adds a check for target_tenant, it must be a string which length is TENANT_ID_MAX_LEN. This patch also does a change for policy engine which now allows enforce_policy to work on attrs without default. Change-Id: I757b4b56a8cb1a8060cee3103ee2aead9be574de Closes-bug: #1517331 ** Changed in: neutron Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1517331 Title: RBAC: create RBAC policy without target-tenant will raise internal error Status in neutron: Fix Released Bug description: I create a RBAC policy without target-tenant will raise internal error: neutron rbac-create --type network --action access_as_shared test_net the error log as bellow: File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement compiled_sql, distilled_params File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context context) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception util.raise_from_cause(newraise, exc_info) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause reraise(type(exception), exception, tb=exc_tb) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 146, in execute result = self._query(query) File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 296, in _query conn.query(q) File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 781, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 942, in _read_query_result result.read() File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1138, in read first_packet = self.connection._read_packet() File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 906, in _read_packet packet.check_error() File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 367, in check_error err.raise_mysql_exception(self._data) File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 120, in raise_mysql_exception _check_mysql_exception(errinfo) File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 112, in _check_mysql_exception raise errorclass(errno, errorvalue) DBError: (pymysql.err.IntegrityError) (1048, u"Column 'target_tenant' cannot be null") [SQL: u'INSERT INTO networkrbacs (tenant_id, id, target_tenant, action, object_id) VALUES (%s, %s, %s, %s, %s)'] [parameters: (u'22f8728a81dc40f4af03b6bda8fb384f', '162f3c45-cf2a-4e98-9d8f-4e1fb418ccc0', None, u'access_as_shared', u'2eea4cc4-a7a7-4a3e-bde5-f3cb8dd1aad4')] To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1517331/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

