rule and check failed in oslo common policy

Bug #1194354 reported by GuoHui Liu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Undecided
Swann Croiset
oslo-incubator
Fix Released
Undecided
GuoHui Liu

Bug Description

Traceback (most recent call last):
  File "heat/tests/test_common_policy.py", line 133, in test_policy_cw_allow_non_stack_user
    enforcer.enforce(ctx, action, {})
  File "heat/common/policy.py", line 127, in enforce
    return self._check(context, _action, target, self.exc, action=action)
  File "heat/common/policy.py", line 115, in _check
    self.exc, *args, **kwargs)
  File "heat/openstack/common/policy.py", line 262, in enforce
    result = self.rules[rule](target, creds, self)
TypeError: __call__() takes exactly 3 arguments (4 given)

GuoHui Liu (guohliu)
no longer affects: heat
Changed in oslo:
assignee: nobody → GuoHui LIu (guohliu)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/34333
Committed: http://github.com/openstack/oslo-incubator/commit/e4ac367561b3811a9cd94e51accdf8045b7d6adc
Submitter: Jenkins
Branch: master

commit e4ac367561b3811a9cd94e51accdf8045b7d6adc
Author: guohliu <email address hidden>
Date: Tue Jun 25 16:56:22 2013 +0800

    Fix missing argument bug in oslo common policy

    Some checks in policy module missing a argument, this
    patch fixed it by adding the necessary argument.

    Fixed bug #1194354

    Change-Id: I41338675842be517146062d11012462c5c90d6e5

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

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

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

Reviewed: https://review.openstack.org/39692
Committed: http://github.com/openstack/oslo-incubator/commit/b7edc999729bc59a2a3abe7efbb5dbbccfa05c99
Submitter: Jenkins
Branch: master

commit b7edc999729bc59a2a3abe7efbb5dbbccfa05c99
Author: Victor Sergeyev <email address hidden>
Date: Thu Aug 1 15:56:14 2013 +0300

    Fix missing argument bug in oslo common policy

    AndCheck() and OrCheck() classes in common policy module missing a argument
    when calls rules in __call__() method.
    Current patch fixed it by adding the necessary argument. Tests added.

    Fixed bug 1194354

    Change-Id: I9a6e7d04b06ef61216cb7dbfd291c855b799b621

Revision history for this message
Swann Croiset (swann-w) wrote :

For ceilometer :

with policy.json:
{
    "context_is_admin": [["role:admin"], ["role:monitor"]]
}

/var/log/ceilometer# tail -n 50 ceilometer-api.log

  File "/usr/local/lib/python2.7/dist-packages/ceilometer/api/controllers/v2.py", line 1133, in get_all
    pecan.request.storage_conn.get_alarms)

  File "/usr/local/lib/python2.7/dist-packages/ceilometer/api/controllers/v2.py", line 245, in _query_to_kwargs
    query = _sanitize_query(query)

  File "/usr/local/lib/python2.7/dist-packages/ceilometer/api/controllers/v2.py", line 220, in _sanitize_query
    auth_project = acl.get_limited_to_project(pecan.request.headers)

  File "/usr/local/lib/python2.7/dist-packages/ceilometer/api/acl.py", line 54, in get_limited_to_project
    {'roles': headers.get('X-Roles', "").split(",")}):

  File "/usr/local/lib/python2.7/dist-packages/ceilometer/openstack/common/policy.py", line 260, in enforce
    result = self.rules[rule](target, creds, self)

  File "/usr/local/lib/python2.7/dist-packages/ceilometer/openstack/common/policy.py", line 446, in __call__
    if rule(target, cred):

Changed in ceilometer:
assignee: nobody → Swann Croiset (swann-w)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/45210
Committed: http://github.com/openstack/ceilometer/commit/d8ecd12b5151548de26e95e070c4f85056b507f2
Submitter: Jenkins
Branch: master

commit d8ecd12b5151548de26e95e070c4f85056b507f2
Author: Swann Croiset <email address hidden>
Date: Thu Sep 5 12:22:40 2013 +0200

    Update openstack.common.policy from oslo-incubator

    This includes the following changes:
     64bb5e2f5 Fix wrong argument in openstack common policy
     b7edc9997 Fix missing argument bug in oslo common policy
     3626b6db9 Fix policy default_rule issue

    Fixes Bug #1194354

    Change-Id: I611816a238034e248c5abd3b07ee751098438f53

Changed in ceilometer:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: havana-2 → 2013.2
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: havana-rc1 → 2013.2
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.