mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix legacy PEP8 violations in zabbix modules, remove test exception for them (#31702)
* fix legacy PEP8 violations in zabbix_*, remove test exception for them * fix new pep8 violations for zabbix_maintenance.py
This commit is contained in:
parent
85bd104c7c
commit
1b71fb0499
6 changed files with 14 additions and 21 deletions
|
@ -226,7 +226,6 @@ import copy
|
||||||
try:
|
try:
|
||||||
from zabbix_api import ZabbixAPI, ZabbixAPISubClass
|
from zabbix_api import ZabbixAPI, ZabbixAPISubClass
|
||||||
|
|
||||||
|
|
||||||
# Extend the ZabbixAPI
|
# Extend the ZabbixAPI
|
||||||
# Since the zabbix-api python module too old (version 1.0, no higher version so far),
|
# Since the zabbix-api python module too old (version 1.0, no higher version so far),
|
||||||
# it does not support the 'hostinterface' api calls,
|
# it does not support the 'hostinterface' api calls,
|
||||||
|
@ -238,7 +237,6 @@ try:
|
||||||
ZabbixAPI.__init__(self, server, timeout=timeout, user=user, passwd=passwd, validate_certs=validate_certs)
|
ZabbixAPI.__init__(self, server, timeout=timeout, user=user, passwd=passwd, validate_certs=validate_certs)
|
||||||
self.hostinterface = ZabbixAPISubClass(self, dict({"prefix": "hostinterface"}, **kwargs))
|
self.hostinterface = ZabbixAPISubClass(self, dict({"prefix": "hostinterface"}, **kwargs))
|
||||||
|
|
||||||
|
|
||||||
HAS_ZABBIX_API = True
|
HAS_ZABBIX_API = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_ZABBIX_API = False
|
HAS_ZABBIX_API = False
|
||||||
|
|
|
@ -172,6 +172,7 @@ class HostMacro(object):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._module.fail_json(msg="Failed to delete host macro %s: %s" % (macro_name, e))
|
self._module.fail_json(msg="Failed to delete host macro %s: %s" % (macro_name, e))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
|
|
|
@ -380,11 +380,11 @@ def main():
|
||||||
module.fail_json(msg="Failed to check maintenance %s existence: %s" % (name, error))
|
module.fail_json(msg="Failed to check maintenance %s existence: %s" % (name, error))
|
||||||
|
|
||||||
if maintenance and (
|
if maintenance and (
|
||||||
sorted(group_ids) != sorted(maintenance["groupids"])
|
sorted(group_ids) != sorted(maintenance["groupids"]) or
|
||||||
or sorted(host_ids) != sorted(maintenance["hostids"])
|
sorted(host_ids) != sorted(maintenance["hostids"]) or
|
||||||
or str(maintenance_type) != maintenance["maintenance_type"]
|
str(maintenance_type) != maintenance["maintenance_type"] or
|
||||||
or str(int(start_time)) != maintenance["active_since"]
|
str(int(start_time)) != maintenance["active_since"] or
|
||||||
or str(int(start_time + period)) != maintenance["active_till"]
|
str(int(start_time + period)) != maintenance["active_till"]
|
||||||
):
|
):
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
changed = True
|
changed = True
|
||||||
|
|
|
@ -8,7 +8,6 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
|
@ -171,11 +171,6 @@ lib/ansible/modules/monitoring/sensu_check.py
|
||||||
lib/ansible/modules/monitoring/sensu_subscription.py
|
lib/ansible/modules/monitoring/sensu_subscription.py
|
||||||
lib/ansible/modules/monitoring/stackdriver.py
|
lib/ansible/modules/monitoring/stackdriver.py
|
||||||
lib/ansible/modules/monitoring/uptimerobot.py
|
lib/ansible/modules/monitoring/uptimerobot.py
|
||||||
lib/ansible/modules/monitoring/zabbix_group.py
|
|
||||||
lib/ansible/modules/monitoring/zabbix_host.py
|
|
||||||
lib/ansible/modules/monitoring/zabbix_hostmacro.py
|
|
||||||
lib/ansible/modules/monitoring/zabbix_maintenance.py
|
|
||||||
lib/ansible/modules/monitoring/zabbix_screen.py
|
|
||||||
lib/ansible/modules/network/a10/a10_server_axapi3.py
|
lib/ansible/modules/network/a10/a10_server_axapi3.py
|
||||||
lib/ansible/modules/network/a10/a10_virtual_server.py
|
lib/ansible/modules/network/a10/a10_virtual_server.py
|
||||||
lib/ansible/modules/network/aos/aos_asn_pool.py
|
lib/ansible/modules/network/aos/aos_asn_pool.py
|
||||||
|
|
Loading…
Add table
Reference in a new issue