Added missing logout to zabbix_user_info module (#65146)

This commit is contained in:
Dusan Matejka 2019-11-21 13:41:28 +01:00 committed by Abhijeet Kasurde
parent ede62b8ad4
commit 1a7823af03

View file

@ -21,8 +21,8 @@ version_added: '2.10'
description:
- This module allows you to search for Zabbix user entries.
requirements:
- python >= 2.6
- zabbix-api
- "python >= 2.6"
- "zabbix-api >= 0.5.4"
options:
alias:
description:
@ -89,6 +89,7 @@ zabbix_user:
}
'''
import atexit
import traceback
try:
@ -160,6 +161,7 @@ def main():
zbx = ZabbixAPI(server_url, timeout=timeout, user=http_login_user, passwd=http_login_password,
validate_certs=validate_certs)
zbx.login(login_user, login_password)
atexit.register(zbx.logout)
except Exception as e:
module.fail_json(msg="Failed to connect to Zabbix server: %s" % e)