From: Kefu Chai Date: Wed, 27 Jan 2021 04:26:42 +0000 (+0800) Subject: mgr/zabbix: use Option for adding options X-Git-Tag: v17.1.0~3148^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4287066e13e589fc98b4dfb5fc4683d5a2e04468;p=ceph.git mgr/zabbix: use Option for adding options more type safety Signed-off-by: Kefu Chai --- diff --git a/src/pybind/mgr/zabbix/module.py b/src/pybind/mgr/zabbix/module.py index d427038fa310..74ebf7a277ff 100644 --- a/src/pybind/mgr/zabbix/module.py +++ b/src/pybind/mgr/zabbix/module.py @@ -9,7 +9,7 @@ import errno import re from subprocess import Popen, PIPE from threading import Event -from mgr_module import MgrModule +from mgr_module import MgrModule, Option def avg(data): @@ -60,33 +60,28 @@ class Module(MgrModule): for o in self.MODULE_OPTIONS) MODULE_OPTIONS = [ - { - 'name': 'zabbix_sender', - 'default': '/usr/bin/zabbix_sender' - }, - { - 'name': 'zabbix_host', - 'default': None - }, - { - 'name': 'zabbix_port', - 'type': 'int', - 'default': 10051 - }, - { - 'name': 'identifier', - 'default': "" - }, - { - 'name': 'interval', - 'type': 'secs', - 'default': 60 - }, - { - 'name': 'discovery_interval', - 'type': 'count', - 'default': 100 - } + Option( + name='zabbix_sender', + default='/usr/bin/zabbix_sender'), + Option( + name='zabbix_host', + type='str', + default=None), + Option( + name='zabbix_port', + type='int', + default=10051), + Option( + name='identifier', + default=""), + Option( + name='interval', + type='secs', + default=60), + Option( + name='discovery_interval', + type='count', + default=100) ] COMMANDS = [