Module: check_mk
Branch: master
Commit: b2f646347e00f2d96be9dfa47750579aabb8d782
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b2f646347e00f2…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Nov 7 10:20:13 2017 +0100
Moved port_match function out of loop
Change-Id: I56aad7bd7937d8c77886f794892de298beaeec39
---
checks/if.include | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/checks/if.include b/checks/if.include
index 5b76a66..afbc61b 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -295,6 +295,14 @@ def inventory_if_common(info, has_nodeinfo = False):
# if there are no settings, use defaults
settings_sets.append({})
+ def port_match(name, what):
+ if what == None:
+ return True
+ for r in what:
+ if regex(r).match(name):
+ return True
+ return False
+
for settings in settings_sets:
uses_description = settings.get('use_desc',
if_inventory_uses_description)
uses_alias = settings.get('use_alias', if_inventory_uses_alias)
@@ -306,14 +314,6 @@ def inventory_if_common(info, has_nodeinfo = False):
match_desc = settings.get('match_desc')
pad_portnumbers = settings.get('pad_portnumbers',
if_inventory_pad_portnumbers)
- def port_match(name, what):
- if what == None:
- return True
- for r in what:
- if regex(r).match(name):
- return True
- return False
-
# Allow main check to set no port type (e.g. hitachi_hnas_fc_if)
porttypes.append("")