zhenzan@zhenzan-openstack:~/workspace/congress$ ocp rule create testaba 'p(x):-q(x)'
ERROR: openstack Element already exists (HTTP 409) (Request-ID: req-3e62ae99-d6ca-4ce3-a1a0-58ba7aef73c4)
zhenzan@zhenzan-openstack:~/workspace/congress$ ocp rule list testaba
zhenzan@zhenzan-openstack:~/workspace/congress$
2015-04-21 10:22:38.560 DEBUG congress.api.application [req-30884fb4-a1b1-4eb6-aeeb-20039ec1f817 admin 9622c906ef6d44adb670abe78eab2b1f] Handling request 'POST /v1/policies/testaba/rules' with CollectionHandler(/v1/policies/(?P<policy_id>[^/]+)/rules$) from (pid=19457) __call__ /home/zhenzan/workspace/congress/congress/api/application.py:45
2015-04-21 10:22:38.562 ERROR congress.api.webservice [req-30884fb4-a1b1-4eb6-aeeb-20039ec1f817 admin 9622c906ef6d44adb670abe78eab2b1f] Error occurred
2015-04-21 10:22:38.562 TRACE congress.api.webservice Traceback (most recent call last):
2015-04-21 10:22:38.562 TRACE congress.api.webservice File "/home/zhenzan/workspace/congress/congress/api/webservice.py", line 392, in create_member
2015-04-21 10:22:38.562 TRACE congress.api.webservice item, request.params, id_, context=context)
2015-04-21 10:22:38.562 TRACE congress.api.webservice File "/home/zhenzan/workspace/congress/congress/api/rule_model.py", line 128, in add_item
2015-04-21 10:22:38.562 TRACE congress.api.webservice changes = self.change_rule(rule, context)
2015-04-21 10:22:38.562 TRACE congress.api.webservice File "/home/zhenzan/workspace/congress/congress/api/rule_model.py", line 186, in change_rule
2015-04-21 10:22:38.562 TRACE congress.api.webservice raise KeyError("Policy with ID '%s' does not exist", policy_name)
2015-04-21 10:22:38.562 TRACE congress.api.webservice KeyError: ("Policy with ID '%s' does not exist", 'testaba')
2015-04-21 10:22:38.562 TRACE congress.api.webservice
2015-04-21 10:22:38.563 INFO eventlet.wsgi.server [req-30884fb4-a1b1-4eb6-aeeb-20039ec1f817 admin 9622c906ef6d44adb670abe78eab2b1f] 10.239.47.22 - - [21/Apr/2015 10:22:38] "POST /v1/policies/testaba/rules HTTP/1.1" 409 307 0.056563
rule_model.py:add_item() always thinks KeyErrors as "ID already exists".
Fix proposed to branch: master /review. openstack. org/176573
Review: https:/