[openstack-dev] [Congress] Confused syntax error when inserting rule.
Rui Chen
chenrui.momo at gmail.com
Fri Aug 14 03:06:00 UTC 2015
Sorry, send the same mail again, please comments at here, the other mail
lack title.
2015-08-14 11:03 GMT+08:00 Rui Chen <chenrui.momo at gmail.com>:
> Hi folks:
>
> I face a problem when I insert a rule into Congress. I want to find
> out all of the volumes that are not available status, so I draft a rule
> like this:
>
> error(id) :- cinder:volumes(id=id), not cinder:volumes(id=id,
> status="available")
>
> But when I create the rule, a error is raised:
>
> (openstack) congress policy rule create chenrui_p "error(id) :-
> cinder:volumes(id=id),not cinder:volumes(id=id, status=\"available\")"
> ERROR: openstack Syntax error for rule::Errors: Could not reorder rule
> error(id) :- cinder:volumes(id, _x_0_1, _x_0_2, _x_0_3, _x_0_4, _x_0_5,
> _x_0_6, _x_0_7, _x_0_8), not cinder:volumes(id, _x_1_1, _x_1_2,
> "available", _x_1_4, _x_1_5, _x_1_6, _x_1_7, _x_1_8). Unsafe lits: not
> cinder:volumes(id, _x_1_1, _x_1_2, "available", _x_1_4, _x_1_5, _x_1_6,
> _x_1_7, _x_1_8) (vars set(['_x_1_2', '_x_1_1', '_x_1_6', '_x_1_7',
> '_x_1_4', '_x_1_5', '_x_1_8'])) (HTTP 400) (Request-ID:
> req-1f4432d6-f869-472b-aa7d-4cf78dd96fa1)
>
> I check the Congress policy docs [1], looks like that the rule don't
> break any syntax restrictions.
>
> If I modify the rule like this, it works:
>
> (openstack) congress policy rule create chenrui_p "error(x) :-
> cinder:volumes(x, _x_0_1, _x_0_2, _x_0_3, _x_0_4, _x_0_5, _x_0_6, _x_0_7,
> _x_0_8),not cinder:volumes(x, _x_0_1, _x_0_2, \"available\",_x_0_4, _x_0_5,
> _x_0_6, _x_0_7, _x_0_8)"
>
> +---------+------------------------------------------------------------------------------------------------+
> | Field | Value
> |
>
> +---------+------------------------------------------------------------------------------------------------+
> | comment | None
> |
> | id | ad121e09-ba0a-45d6-bd18-487d975d5bf5
> |
> | name | None
> |
> | rule | error(x) :-
> |
> | | cinder:volumes(x, _x_0_1, _x_0_2, _x_0_3, _x_0_4, _x_0_5,
> _x_0_6, _x_0_7, _x_0_8), |
> | | not cinder:volumes(x, _x_0_1, _x_0_2, "available", _x_0_4,
> _x_0_5, _x_0_6, _x_0_7, _x_0_8) |
>
> +---------+------------------------------------------------------------------------------------------------+
>
> I'm not sure this is a bug or I miss something from docs, so I need
> some feedback from mail list.
> Feel free to discuss about it.
>
>
> [1]:
> http://congress.readthedocs.org/en/latest/policy.html#datalog-syntax-restrictions
>
>
> Best Regards.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150814/77b80e1c/attachment.html>
More information about the OpenStack-dev
mailing list