server cannot be restarted if there is an action rule with left side of form <policy>:<rule> defined in action policy

Bug #1439536 reported by Radek Pospisil
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
congress
Fix Released
Undecided
Unassigned

Bug Description

congress in devstack with last commit 97af67204c0573cdd0157ad19c8e5d7b4baffb74 Merge "Adds action execution interface"

I'm using action policy with 'action' rules (left side of rule is murano:properties-(...)'. If I stop the congress server and restart it, then ti fails with exception "PolicyException: Errors: Rule head murano:properties-(oid, pn, pv) should not reference any policy: m
urano:properties-(oid, pn, pv) :- deleteEnv(eid), murano:connected(eid, oid), murano:properties(oid, pn, pv)"

scenario
* execute
openstack congress policy create murano_action --kind action
openstack congress policy rule create murano_action 'action("deleteEnv")'
openstack congress policy rule create murano_action 'murano:properties-(oid, pn, pv) :- deleteEnv(eid), murano:connected( eid, oid), murano:properties(oid, pn, pv)'

* stop congress server (using screen -r stack and CTRL+C in congress' screen)
* start congress the server (using screen -r stack and cursor-up + enter in congress' screen)
** exception is reported:

2015-04-02 08:58:23.594 13210 DEBUG congress.dse.deepsix [-] d6cage:: pushing dataindex services to subscribers {} and requesters {} log_debug /opt/stack
/congress/congress/dse/deepsix.py:565
2015-04-02 08:58:23.594 13210 DEBUG congress.dse.deepsix [-] d6cage:: no requesters/subscribers; not sending log_debug /opt/stack/congress/congress/dse/de
epsix.py:565
2015-04-02 08:58:23.603 13210 DEBUG keystoneclient.session [-] REQ: curl -g -i -X GET http://16.60.142.48:35357/v2.0/users -H "User-Agent: python-keystone
client" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}7b8b77caaacce134d257303e86a89ea34a89cf92" _http_log_request /usr/local/lib/python2.7/dist-pa
ckages/keystoneclient/session.py:195
2015-04-02 08:58:23.614 13210 DEBUG congress.dse.deepsix [-] engine:: process_policy_update [<congress.datalog.compile.Event object at 0x7f5856673690>] lo
g_debug /opt/stack/congress/congress/dse/deepsix.py:565
2015-04-02 08:58:23.615 13210 DEBUG congress.datalog.base [-] RT : Updating with <congress.datalog.utility.iterstr object at 0x7f58565f9350> log /opt/s
tack/congress/congress/datalog/base.py:46
2015-04-02 08:58:23.616 13210 DEBUG congress.datalog.base [-] muran : update_would_cause_errors <congress.datalog.utility.iterstr object at 0x7f58565f9350
> log /opt/stack/congress/congress/datalog/base.py:46
2015-04-02 08:58:23.617 13210 DEBUG congress.dse.deepsix [-] engine:: Tables:: Old: set([]), new: set([]), add: set([]), rem: set([]) log_debug /opt/stack
/congress/congress/dse/deepsix.py:565
2015-04-02 08:58:23.617 13210 ERROR congress.service [-] Fatal Exception:
2015-04-02 08:58:23.617 13210 TRACE congress.service Traceback (most recent call last):
2015-04-02 08:58:23.617 13210 TRACE congress.service File "/opt/stack/congress/congress/service.py", line 32, in wrapper
2015-04-02 08:58:23.617 13210 TRACE congress.service return f(*args, **kw)
2015-04-02 08:58:23.617 13210 TRACE congress.service File "/opt/stack/congress/congress/service.py", line 53, in congress_app_factory
2015-04-02 08:58:23.617 13210 TRACE congress.service cage = harness.create(root_path, policy_path, data_path)
2015-04-02 08:58:23.617 13210 TRACE congress.service File "/opt/stack/congress/congress/harness.py", line 242, in create
2015-04-02 08:58:23.617 13210 TRACE congress.service {'policy_id': rule.policy_name})
2015-04-02 08:58:23.617 13210 TRACE congress.service File "/opt/stack/congress/congress/api/rule_model.py", line 183, in change_rule
2015-04-02 08:58:23.617 13210 TRACE congress.service "Errors: " + ";".join((str(x) for x in changes)))
2015-04-02 08:58:23.617 13210 TRACE congress.service PolicyException: Errors: Rule head murano:properties-(oid, pn, pv) should not reference any policy: m
urano:properties-(oid, pn, pv) :- deleteEnv(eid), murano:connected(eid, oid), murano:properties(oid, pn, pv)
2015-04-02 08:58:23.617 13210 TRACE congress.service
congress failed to start

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

Reviewed: https://review.openstack.org/170255
Committed: https://git.openstack.org/cgit/stackforge/congress/commit/?id=61c6aeaa9b1a5f67cde4a63f75383c4c29de19c1
Submitter: Jenkins
Branch: master

commit 61c6aeaa9b1a5f67cde4a63f75383c4c29de19c1
Author: Tim Hinrichs <email address hidden>
Date: Thu Apr 2 10:00:35 2015 -0700

    Fix bug in action theory on restart

    The bug was that creating a theory of kind 'action' produced
    an in-memory 'action' policy but stored the type of that policy
    as 'nonrecursive' in the database. So on restart, the policy
    engine would create a policy of the wrong kind, which would
    in turn cause some rules stored in the DB to be incorrectly
    rejected, thereby causing a fatal error.

    The fix was to change the code that looked up the type of
    a theory from checking isinstance() to looking at the
    field of the theory that is set to the name of the policy
    type.

    Change-Id: I869fa835d07a863e8d5473a638db52e3ed4d6133
    Closes-bug: 1439536

Changed in congress:
status: New → Fix Committed
Tim Hinrichs (thinrichs)
Changed in congress:
milestone: none → kilo-3
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.