]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Make CloudWatchAlarm names unique per-tenant
authorSteven Hardy <shardy@redhat.com>
Mon, 19 Nov 2012 15:31:01 +0000 (15:31 +0000)
committerSteven Hardy <shardy@redhat.com>
Mon, 19 Nov 2012 22:26:20 +0000 (22:26 +0000)
Use physical_resource_name to ensure CloudWatchAlarm resources
are unique per tenant

Ref bug 1078779

Change-Id: Id37393decd8d4f89e79af5c7e9eeb21f4e494699
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/engine/resources/cloud_watch.py

index bc02625aa9e3d1d38cde1cfbd720c453fb4a93cb..f8a54e64580b55accc988c19eaf75d1b06f95e3d 100644 (file)
@@ -54,7 +54,8 @@ class CloudWatchAlarm(resource.Resource):
     strict_dependency = False
 
     def handle_create(self):
-        wr = watchrule.WatchRule(context=self.context, watch_name=self.name,
+        wr = watchrule.WatchRule(context=self.context,
+                                 watch_name=self.physical_resource_name(),
                                  rule=self.parsed_template('Properties'),
                                  stack_id=self.stack.id)
         wr.store()
@@ -64,9 +65,10 @@ class CloudWatchAlarm(resource.Resource):
 
     def handle_delete(self):
         try:
-            db_api.watch_rule_delete(self.context, self.name)
+            db_api.watch_rule_delete(self.context,
+                                     self.physical_resource_name())
         except exception.NotFound:
             pass
 
     def FnGetRefId(self):
-        return unicode(self.name)
+        return unicode(self.physical_resource_name())