From 2f98ee47b719f5a92fefb69b056c9e786fde2fbb Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Tue, 15 Jan 2013 13:42:57 +0100 Subject: [PATCH] Don't inherit from NestedStack The NestedStack class is intended only to be the implementation of the AWS::CloudFormation::Stack resource type. Other resources whose internal implementation uses a nested stack should subclass the abstract StackResource class. Change-Id: Ic311c220dbf9bdf539d68f4004c8dc14752e057e Signed-off-by: Zane Bitter --- heat/engine/resources/dbinstance.py | 10 ++++++++-- heat/engine/resources/loadbalancer.py | 13 ++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/heat/engine/resources/dbinstance.py b/heat/engine/resources/dbinstance.py index 6b6029be..e22c0d38 100644 --- a/heat/engine/resources/dbinstance.py +++ b/heat/engine/resources/dbinstance.py @@ -14,7 +14,7 @@ # under the License. from heat.common import exception -from heat.engine.resources import stack +from heat.engine import stack_resource from heat.common import template_format from heat.openstack.common import log as logging @@ -150,7 +150,7 @@ mysql_template = r''' ''' -class DBInstance(stack.NestedStack): +class DBInstance(stack_resource.StackResource): properties_schema = { 'DBSnapshotIdentifier': {'Type': 'String', @@ -216,6 +216,12 @@ class DBInstance(stack.NestedStack): templ = template_format.parse(mysql_template) self.create_with_template(templ, self._params()) + def handle_update(self): + return self.UPDATE_REPLACE + + def handle_delete(self): + self.delete_nested() + def FnGetAtt(self, key): ''' We don't really support any of these yet. diff --git a/heat/engine/resources/loadbalancer.py b/heat/engine/resources/loadbalancer.py index e690739e..ebdb72aa 100644 --- a/heat/engine/resources/loadbalancer.py +++ b/heat/engine/resources/loadbalancer.py @@ -16,7 +16,7 @@ from heat.engine import clients from heat.common import exception from heat.common import template_format -from heat.engine.resources import stack +from heat.engine import stack_resource from heat.openstack.common import log as logging @@ -153,7 +153,7 @@ lb_template = ''' # file at the moment this is because we will probably need to implement a # LoadBalancer based on keepalived as well (for for ssl support). # -class LoadBalancer(stack.NestedStack): +class LoadBalancer(stack_resource.StackResource): listeners_schema = { 'InstancePort': {'Type': 'Number', @@ -290,6 +290,12 @@ class LoadBalancer(stack.NestedStack): self.create_with_template(templ, param) + def handle_update(self): + return self.UPDATE_REPLACE + + def handle_delete(self): + self.delete_nested() + def validate(self): ''' Validate any of the provided params @@ -322,9 +328,6 @@ class LoadBalancer(stack.NestedStack): def FnGetRefId(self): return unicode(self.name) - def handle_update(self): - return self.UPDATE_REPLACE - def FnGetAtt(self, key): ''' We don't really support any of these yet. -- 2.45.2