From 6bd40787ce6f0e7d4825fe49fe5f9c7d07c1e664 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Fri, 11 Sep 2015 08:52:30 +0200 Subject: [PATCH] cloudstack: fix templates not always have checksums It is not documented but it seems only registered templates have checksums. Templates created from VMs and snapshot don't. This change fixes the traceback. But we must re-thinking, if it still makes sense to look for the checksum. --- cloud/cloudstack/cs_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud/cloudstack/cs_template.py b/cloud/cloudstack/cs_template.py index ed5472c2c3e..fbaa5665eb2 100644 --- a/cloud/cloudstack/cs_template.py +++ b/cloud/cloudstack/cs_template.py @@ -501,7 +501,7 @@ class AnsibleCloudStackTemplate(AnsibleCloudStack): return templates['template'][0] else: for i in templates['template']: - if i['checksum'] == checksum: + if 'checksum' in i and i['checksum'] == checksum: return i return None