Skip to content

Commit

Permalink
ovirt_vms: Raise proper error when template isn't found (#30306)
Browse files Browse the repository at this point in the history
  • Loading branch information
machacekondra authored and ansibot committed Oct 4, 2017
1 parent 04f0b5a commit 70f221d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/ansible/modules/cloud/ovirt/ovirt_vms.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,14 @@ def __get_template_with_version(self):
t for t in templates
if t.version.version_number == self.param('template_version')
]
if templates:
template = templates[0]
if not templates:
raise ValueError(
"Template with name '%s' and version '%s' was not found'" % (
self.param('template'),
self.param('template_version')
)
)
template = templates[0]

return template

Expand Down

0 comments on commit 70f221d

Please sign in to comment.