]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Fix listing stacks
authorTomas Sedovic <tomas@sedovic.cz>
Fri, 13 Apr 2012 12:43:07 +0000 (14:43 +0200)
committerTomas Sedovic <tomas@sedovic.cz>
Fri, 13 Apr 2012 12:43:07 +0000 (14:43 +0200)
`heat list` was failing for non-empty stacks because the `Stack` model had no
`template` attribute.

Also fixed an issue where we didn't show the template description when the
stack status was unknown.

heat/engine/manager.py

index f50315afc6b95603e667c569bbae0bd2596d1890..9ea416125e1ca430727e1f6f781fdaf9e9ec6e71 100644 (file)
@@ -48,12 +48,8 @@ class EngineManager(manager.Manager):
             mem['stack_id'] = s.id
             mem['stack_name'] = s.name
             mem['created_at'] = str(s.created_at)
-            try:
-                mem['template_description'] = s.template.description
-                mem['stack_status'] = ps.t['StackStatus']
-            except KeyError:
-                mem['template_description'] = 'No description'
-                mem['stack_status'] = 'unknown'
+            mem['template_description'] = ps.t.get('Description', 'No description')
+            mem['stack_status'] = ps.t.get('StackStatus', 'unknown')
             res['stacks'].append(mem)
 
         return res