Skip to content

Commit 397f0aa

Browse files
committed
Capture 'app' context for modinput input_items
- Update modularinput XML parsing to capture the 'app' tag for configuration stanza elements. This value is stored in the input dict under '__app' to avoid potential naming collisions with user defined parameters. - Updated unittest
1 parent c8fe42c commit 397f0aa

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

splunklib/modularinput/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ def parse_xml_data(parent_node, child_node_tag):
6666
for child in parent_node:
6767
if child.tag == child_node_tag:
6868
if child_node_tag == "stanza":
69-
data[child.get("name")] = {}
69+
data[child.get("name")] = {
70+
"__app": child.get("app", None)
71+
}
7072
for param in child:
7173
data[child.get("name")][param.get("name")] = parse_parameters(param)
7274
elif "item" == parent_node.tag:
52 Bytes
Binary file not shown.
26 Bytes
Binary file not shown.

tests/modularinput/test_input_definition.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ def test_parse_inputdef_with_two_inputs(self):
4848
"session_key": "123102983109283019283"
4949
}
5050
expectedDefinition.inputs["foobar://aaa"] = {
51+
"__app": "search",
5152
"param1": "value1",
5253
"param2": "value2",
5354
"disabled": "0",
5455
"index": "default"
5556
}
5657
expectedDefinition.inputs["foobar://bbb"] = {
58+
"__app": "my_app",
5759
"param1": "value11",
5860
"param2": "value22",
5961
"disabled": "0",

0 commit comments

Comments
 (0)