CLOUDSTACK-5113: Fix get_template method to return 'BUILTIN' template

by default
This commit is contained in:
SrikanteswaraRao Talluri 2014-01-07 17:39:19 +05:30
parent 85df58d107
commit 249993b2f1
1 changed files with 5 additions and 3 deletions

View File

@ -209,7 +209,9 @@ def get_pod(apiclient, zoneid, services=None):
raise Exception("Exception: Failed to find specified pod.")
def get_template(apiclient, zoneid, ostype, services=None):
def get_template(apiclient, zoneid, ostype, services=None,
templatefilter='featured',
templatetype='BUILTIN'):
"Returns a template"
cmd = listOsTypes.listOsTypesCmd()
@ -223,7 +225,7 @@ def get_template(apiclient, zoneid, ostype, services=None):
"Failed to find OS type with description: %s" % ostype)
cmd = listTemplates.listTemplatesCmd()
cmd.templatefilter = 'featured'
cmd.templatefilter = templatefilter
cmd.zoneid = zoneid
if services:
@ -237,7 +239,7 @@ def get_template(apiclient, zoneid, ostype, services=None):
for template in list_templates:
if template.ostypeid == ostypeid:
return template
elif template.isready:
elif template.isready and template.templatetype == templatetype:
return template
raise Exception("Exception: Failed to find template with OSTypeID: %s" %