mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
zabbix_host: make host_groups actually optional on update (#33099)
* When updating a host, host_groups need not necessarily be specified. * Also set host_groups for later equivalency tests
This commit is contained in:
parent
5f5e150771
commit
50c9f91060
1 changed files with 6 additions and 2 deletions
|
@ -25,6 +25,7 @@ author:
|
||||||
- "Tony Minfei Ding"
|
- "Tony Minfei Ding"
|
||||||
- "Harrison Gu (@harrisongu)"
|
- "Harrison Gu (@harrisongu)"
|
||||||
- "Werner Dijkerman"
|
- "Werner Dijkerman"
|
||||||
|
- "Eike Frost (@eikef)"
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 2.6"
|
- "python >= 2.6"
|
||||||
- "zabbix-api >= 0.5.3"
|
- "zabbix-api >= 0.5.3"
|
||||||
|
@ -639,8 +640,11 @@ def main():
|
||||||
host.delete_host(host_id, host_name)
|
host.delete_host(host_id, host_name)
|
||||||
module.exit_json(changed=True, result="Successfully delete host %s" % host_name)
|
module.exit_json(changed=True, result="Successfully delete host %s" % host_name)
|
||||||
else:
|
else:
|
||||||
if not group_ids:
|
if not host_groups:
|
||||||
module.fail_json(msg="Specify at least one group for updating host '%s'." % host_name)
|
# if host_groups have not been specified when updating an existing host, just
|
||||||
|
# get the group_ids from the existing host without updating them.
|
||||||
|
host_groups = host.get_host_groups_by_host_id(host_id)
|
||||||
|
group_ids = host.get_group_ids_by_group_names(host_groups)
|
||||||
|
|
||||||
if not force:
|
if not force:
|
||||||
# get existing groups, interfaces and templates and merge them with ones provided as an argument
|
# get existing groups, interfaces and templates and merge them with ones provided as an argument
|
||||||
|
|
Loading…
Reference in a new issue