From d3b680e1c9b5c37fd07fd9999e9746871fd19824 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. --- lib/ansible/modules/extras/cloud/cloudstack/cs_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py index ed5472c2c3e..fbaa5665eb2 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py +++ b/lib/ansible/modules/extras/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