[openstack-dev] [congress] table with named parameters in rule's left side ?
Pospisil, Radek
radek.pospisil at hp.com
Thu Jun 11 13:41:12 UTC 2015
Hello,
Is it possible to have named parameters on rule's left side, for example:
1. predeploy_modify(eid,oid,"add_property",5, name="image", value=pvalue) :- .... Glancev2:images(name=pvalue,...)
2. predeploy_modify(eid,oid,"add_object", 10, type="monitoring", port=8190, path="/aa/bb") :- ....
My Usecase is following - I want to use Congress to provide me list of 'actions' that I have to do on Murano environment prior it is deployed - for example:
* I want to enforce/use specific image for given component(s) in environment, so I set corresponding property (example 1)
* I want to add an object (monitoring) with properties to environment (example 2)
Thus generally "I want to query for one rule with variable set/dictionary of arguments" - for example using simulation API:
$ openstack congress policy simulate test 'predeploy_modify()' '' action
Result will be
predeploy_modify(<uuid>,<uuid>,'add_property', 5, name="image", value="<uuid>")
predeploy_modify(<uuid>,<uuid>,'add_object', 10, type="monitoring", port="...", path="...")
The problem is that if I do (as an example):
$ openstack congress policy rule create test "a(o,p,q=4) :- b(o),b(p)"
ERROR: openstack Syntax error for rule::Compiler found errors:Atom a(q=4) uses named parameters but the columns for table a have not been declared.
Atom a(q=4) uses named parameters but the columns for table a have not been declared. (HTTP 400) (Request-ID: req-b05683e6-766a-4be8-a238-5811eb6f7125)
So is it possible to use named parameters on not-declared tables?
I know that it is possible to do for "execute[ action(...) ] :- ", where positional and keyword/named set of parameters is passed to action-executor.
Regards,
Radek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150611/6a7f8d93/attachment.html>
More information about the OpenStack-dev
mailing list