]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Don't inherit from NestedStack
authorZane Bitter <zbitter@redhat.com>
Tue, 15 Jan 2013 12:42:57 +0000 (13:42 +0100)
committerGerrit Code Review <review@openstack.org>
Thu, 17 Jan 2013 10:23:33 +0000 (10:23 +0000)
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 <zbitter@redhat.com>
heat/engine/resources/dbinstance.py
heat/engine/resources/loadbalancer.py

index 6b6029beec205e2869f3340b1bd9ff92a8ab7071..e22c0d38a6079654667dd87a465ea64177540093 100644 (file)
@@ -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.
index e690739eb6200e5db5a32c3695fddf73bcd3402f..ebdb72aa86b1ffdddd3ff47faf1ff8c23bb4dfe2 100644 (file)
@@ -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.