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.
This commit is contained in:
Rene Moser 2015-09-11 08:52:30 +02:00 committed by Matt Clay
parent d705647873
commit d3b680e1c9

View file

@ -501,7 +501,7 @@ class AnsibleCloudStackTemplate(AnsibleCloudStack):
return templates['template'][0] return templates['template'][0]
else: else:
for i in templates['template']: for i in templates['template']:
if i['checksum'] == checksum: if 'checksum' in i and i['checksum'] == checksum:
return i return i
return None return None