policy file validation errors are hard to debug

Bug #1588552 reported by aeva black
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.policy
Fix Released
Medium
Kseniya Tychkova

Bug Description

While adding new entries to Ironic's policy.json file, I had a typo in a line, but oslo_policy._parser() reports the error from other (correct) lines in the file.

Here's the traceback:

2016-06-02 15:16:03.463 24557 ERROR oslo_policy._parser [-] Failed to understand rule admin_or_ops
2016-06-02 15:16:03.463 24557 ERROR oslo_policy._parser Traceback (most recent call last):
2016-06-02 15:16:03.463 24557 ERROR oslo_policy._parser File "/opt/source/openstack/ironic/.tox/venv/lib/python3.
5/site-packages/oslo_policy/_parser.py", line 213, in _parse_check
2016-06-02 15:16:03.463 24557 ERROR oslo_policy._parser kind, match = rule.split(':', 1)
2016-06-02 15:16:03.463 24557 ERROR oslo_policy._parser ValueError: not enough values to unpack (expected 2, got 1)
2016-06-02 15:16:03.463 24557 ERROR oslo_policy._parser
2016-06-02 15:16:03.464 24557 ERROR oslo_policy._parser [-] Failed to understand rule admin_or_ops
2016-06-02 15:16:03.464 24557 ERROR oslo_policy._parser Traceback (most recent call last):
2016-06-02 15:16:03.464 24557 ERROR oslo_policy._parser File "/opt/source/openstack/ironic/.tox/venv/lib/python3.
5/site-packages/oslo_policy/_parser.py", line 213, in _parse_check
2016-06-02 15:16:03.464 24557 ERROR oslo_policy._parser kind, match = rule.split(':', 1)
2016-06-02 15:16:03.464 24557 ERROR oslo_policy._parser ValueError: not enough values to unpack (expected 2, got 1)

Here is my policy file. Note the error on the last line, not in the "admin_or_ops" rule.

{
    "default": "rule:admin_or_ops",
    "show_password": "!",
    "admin_api": "role:admin or role:administrator",
    "admin_or_ops": "role:admin or role:operator",
    "baremetal:node:list": "admin_or_ops"
}

Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

Yes this is a real problem! I was helping devananda with debugging some things and ran across this.

Changed in oslo.policy:
status: New → Confirmed
importance: Undecided → Medium
Changed in oslo.policy:
assignee: nobody → Kseniya Tychkova (ktychkova)
Revision history for this message
Kseniya Tychkova (ktychkova) wrote :
Changed in oslo.policy:
status: Confirmed → Fix Committed
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/oslo.policy 1.13.0

This issue was fixed in the openstack/oslo.policy 1.13.0 release.

Changed in oslo.policy:
status: Fix Committed → 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.