]> review.fuel-infra Code Review - openstack-build/heat-build.git/commit
Pass data from handle_create() to check_active()
authorZane Bitter <zbitter@redhat.com>
Tue, 9 Apr 2013 18:01:23 +0000 (20:01 +0200)
committerZane Bitter <zbitter@redhat.com>
Tue, 9 Apr 2013 20:28:38 +0000 (22:28 +0200)
commitbfdee58d2e8d60cb87545a62bd9d2d9c1b372a04
treec0f03d6c7805040abb6f6a314d39a4503b65b143
parent092222de42ca094039364e9a6c4c486a8071220e
Pass data from handle_create() to check_active()

All resources that implement check_active() will require some state to be
retained from the call to handle_create(). Saving this as state in the
Resource object results in repeated, ugly, and potentially error-prone
code.

Instead, allow a subclass-defined state object returned from
handle_create() to be passed to check_active(). This ensures that the state
is limited in scope to where it is meaningful (during the create
operation), and that it will be garbage-collected at the appropriate time,
even if an unexpected exception occurs e.g. because a thread is cancelled.

Change-Id: I9d690b44a066aaf33970562a2b9a55c633a7d4e8
heat/engine/resource.py
heat/engine/resources/autoscaling.py
heat/engine/resources/instance.py
heat/tests/test_autoscaling.py
heat/tests/test_instance_group.py
heat/tests/test_metadata_refresh.py