Module: check_mk
Branch: master
Commit: f2c55446068ec2a7886c16324617787b7232a6eb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f2c55446068ec2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 28 07:53:13 2019 +0100
Minor cleanup of inventory argument computation
CMK-1818
Change-Id: I9f69948f7eef2ae52637f523e0f7369e552dc81c
---
cmk_base/inventory.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/cmk_base/inventory.py b/cmk_base/inventory.py
index 0f558b3..3b02e5b 100644
--- a/cmk_base/inventory.py
+++ b/cmk_base/inventory.py
@@ -260,12 +260,13 @@ def _do_inv_for_realhost(sources, multi_host_sections, hostname,
ipaddress, inve
inv_function_args = inspect.getargspec(inv_function).args
kwargs = {}
- if 'inventory_tree' in inv_function_args:
- inv_function_args.remove('inventory_tree')
- kwargs["inventory_tree"] = inventory_tree
- if 'status_data_tree' in inv_function_args:
- inv_function_args.remove('status_data_tree')
- kwargs["status_data_tree"] = status_data_tree
+ for dynamic_arg_name, dynamic_arg_value in [
+ ("inventory_tree", inventory_tree),
+ ("status_data_tree", status_data_tree),
+ ]:
+ if dynamic_arg_name in inv_function_args:
+ inv_function_args.remove(dynamic_arg_name)
+ kwargs[dynamic_arg_name] = dynamic_arg_value
if len(inv_function_args) == 2:
params = _get_inv_params(hostname, section_name)