ooici/pyon — pull request #129 by ifreecarve (2012-07-20 19:06:46+00:00)
Title: fix bug 'old_state referenced before assignment' when retiring a resource

use constant value for LCS assignment: LCS.RETIRED instead of "RETIRED"

also, fix this bug:

pyon.core.thread: ERROR: Child failed with an exception: ("local variable 'old_state' referenced before assignment", )
IonProcessThread _control_flow caught an exception (call: >, *args (), **kwargs {'resource_id': 'd6b0e29436e04580b7754e27660f0e36'}, context {'conv-seq': 1, 'sender': 'silverlining_local_48134.24', 'protocol': 'rpc', 'language': 'ion-r2', 'sender-name': 'observatory_management', 'encoding': 'msgpack', 'reply-by': 'todo', 'sender-service': 'ion_test_6cd505,observatory_management', 'ts': '1342810620393', 'routing_key': 'resource_registry', 'receiver': 'ion_test_6cd505,resource_registry', 'format': 'resource_registry_retire_in', 'reply-to': 'ion_test_6cd505,amq.gen-K9vjs3k4xS0lBYV7JWDRNw==', 'conv-id': 'silverlining_local_48134-217', 'op': 'retire', 'performative': 'request', 'sender-type': 'service'})
True traceback captured by IonProcessThread' _control_flow:

Traceback (most recent call last):
File "/Users/iankatz/.virtualenvs/artoo/sdtkiai/coi-services/eggs/pyon-0.1.4-py2.7.egg/pyon/ion/process.py", line 131, in _control_flow
res = call(*callargs, **callkwargs)
File "/Users/iankatz/.virtualenvs/artoo/sdtkiai/coi-services/ion/services/coi/resource_registry_service.py", line 44, in retire
return self.resource_registry.retire(resource_id=resource_id)
File "/Users/iankatz/.virtualenvs/artoo/sdtkiai/coi-services/eggs/pyon-0.1.4-py2.7.egg/pyon/ion/resregistry.py", line 129, in retire
self.set_lifecycle_state(resource_id, "RETIRED")
File "/Users/iankatz/.virtualenvs/artoo/sdtkiai/coi-services/eggs/pyon-0.1.4-py2.7.egg/pyon/ion/resregistry.py", line 205, in set_lifecycle_state
old_state=old_state, new_state=target_lcstate)
UnboundLocalError: local variable 'old_state' referenced before assignment