mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 03:30:22 -07:00
ovirt_affinity_lables_facts: Raise error when host/vm not found (#41790)
This commit is contained in:
parent
faa83285dc
commit
0a6ab23f38
1 changed files with 5 additions and 0 deletions
|
@ -98,6 +98,7 @@ from ansible.module_utils.ovirt import (
|
||||||
create_connection,
|
create_connection,
|
||||||
get_dict_of_struct,
|
get_dict_of_struct,
|
||||||
ovirt_facts_full_argument_spec,
|
ovirt_facts_full_argument_spec,
|
||||||
|
search_by_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,6 +128,8 @@ def main():
|
||||||
])
|
])
|
||||||
if module.params['host']:
|
if module.params['host']:
|
||||||
hosts_service = connection.system_service().hosts_service()
|
hosts_service = connection.system_service().hosts_service()
|
||||||
|
if search_by_name(hosts_service, module.params['host']) is None:
|
||||||
|
raise Exception("Host '%s' was not found." % module.params['host'])
|
||||||
labels.extend([
|
labels.extend([
|
||||||
label
|
label
|
||||||
for label in all_labels
|
for label in all_labels
|
||||||
|
@ -135,6 +138,8 @@ def main():
|
||||||
])
|
])
|
||||||
if module.params['vm']:
|
if module.params['vm']:
|
||||||
vms_service = connection.system_service().vms_service()
|
vms_service = connection.system_service().vms_service()
|
||||||
|
if search_by_name(vms_service, module.params['vm']) is None:
|
||||||
|
raise Exception("Vm '%s' was not found." % module.params['vm'])
|
||||||
labels.extend([
|
labels.extend([
|
||||||
label
|
label
|
||||||
for label in all_labels
|
for label in all_labels
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue