diff --git a/package b/package index 44c4e13..ca12331 100644 --- a/package +++ b/package @@ -40,7 +40,7 @@ }, "name": "Check_NSX", "title": "Checkmk extension for NSX-T 3.x", - "version": "0.4.10", - "version.min_required": "2.0.0", - "version.packaged": "2.0.0", + "version": "0.4.11", + "version.min_required": "2.2.0", + "version.packaged": "2.2.0", } diff --git a/web/plugins/wato/nsx_datasource_programs.py b/web/plugins/wato/nsx_datasource_programs.py index 5e85a15..8448593 100644 --- a/web/plugins/wato/nsx_datasource_programs.py +++ b/web/plugins/wato/nsx_datasource_programs.py @@ -1,73 +1,69 @@ #!/usr/bin/env python3 # -*- encoding: utf-8 -*- -import cmk.gui.watolib as watolib +from cmk.gui.i18n import _ +from cmk.gui.plugins.wato.special_agents.common import RulespecGroupVMCloudContainer from cmk.gui.plugins.wato import ( + HostRulespec, IndividualOrStoredPassword, rulespec_registry, - HostRulespec, ) -from cmk.gui.plugins.wato.datasource_programs import RulespecGroupDatasourcePrograms -from cmk.gui.valuespec import Dictionary, DropdownChoice, TextAscii, Transform -from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + DropdownChoice, + TextAscii, +) +from cmk.gui.watolib.rulespecs import Rulespec def _factory_default_special_agents_nsx(): # No default, do not use setting if no rule matches - return watolib.Rulespec.FACTORY_DEFAULT_UNUSED - - -def _transform_agent_nsx(params): - params.setdefault("cert", False) - - return params + return Rulespec.FACTORY_DEFAULT_UNUSED def _valuespec_special_agents_nsx(): - return Transform( - Dictionary( - title=_("Check state of a NSX-T 3.x environment"), - help=_( - "This rule selects the VMWare NSX-T agent instead of the normal Check_MK Agent2 and allows" - "monitoring of NSX-T environment via NSX-T Manager API. You can configure your connection " - "settings here." - ), - elements=[ - ( - "user", - TextAscii( - title=_("Username"), - allow_empty=False, - ), + return Dictionary( + title=_("Check state of a NSX-T 3.x environment"), + help=_( + "This rule selects the VMWare NSX-T agent instead of the normal Check_MK Agent2 and allows" + "monitoring of NSX-T environment via NSX-T Manager API. You can configure your connection " + "settings here." + ), + elements=[ + ( + "user", + TextAscii( + title=_("Username"), + allow_empty=False, ), - ( - "password", - IndividualOrStoredPassword( - title=_("Password"), - allow_empty=False, - ), + ), + ( + "password", + IndividualOrStoredPassword( + title=_("Password"), + allow_empty=False, ), - ( - "cert", - DropdownChoice( - title=_("SSL certificate checking"), - choices=[ - (True, _("Activate")), - (False, _("Deactivated")), - ], - ), + ), + ( + "cert", + DropdownChoice( + title=_("SSL certificate checking"), + choices=[ + (True, _("Activate")), + (False, _("Deactivated")), + ], + default_value=False, ), - ], - optional_keys=["cert"], - ), - forth=_transform_agent_nsx, + ), + ], + optional_keys=["cert"], ) rulespec_registry.register( HostRulespec( factory_default=_factory_default_special_agents_nsx(), - group=RulespecGroupDatasourcePrograms, + group=RulespecGroupVMCloudContainer, name="special_agents:nsx", valuespec=_valuespec_special_agents_nsx, )