CLOUDSTACK-5113: Fix get_template method to return 'BUILTIN' template in ready state with

matching given ostype
This commit is contained in:
SrikanteswaraRao Talluri 2014-01-10 19:51:55 +05:30
parent 641f85cf6f
commit c98ac9aae0

View File

@ -237,15 +237,14 @@ def get_template(apiclient, zoneid, ostype, services=None,
if isinstance(list_templates, list):
assert len(list_templates) > 0, "received empty response on template of type %s"%ostype
for template in list_templates:
if template.ostypeid == ostypeid:
return template
elif template.isready and template.templatetype == templatetype:
if template.ostypeid == ostypeid and template.isready and template.templatetype == templatetype:
return template
raise Exception("Exception: Failed to find template with OSTypeID: %s" %
ostypeid)
raise Exception("Exception: Failed to find template of type %s with OSTypeID and which is in "
"ready state: %s" %(templatetype, ostypeid))
return
def download_systemplates_sec_storage(server, services):
"""Download System templates on sec storage"""