ovirt_vms: Raise proper error when template isn't found (#30306)

pull/30337/head
Ondra Machacek 7 years ago committed by ansibot
parent 04f0b5adca
commit 70f221d57a

@ -599,8 +599,14 @@ class VmsModule(BaseModule):
t for t in templates t for t in templates
if t.version.version_number == self.param('template_version') if t.version.version_number == self.param('template_version')
] ]
if templates: if not templates:
template = templates[0] raise ValueError(
"Template with name '%s' and version '%s' was not found'" % (
self.param('template'),
self.param('template_version')
)
)
template = templates[0]
return template return template

Loading…
Cancel
Save