Skip to content

Commit 4c2ae3b

Browse files
author
Shakeel Mohamed
committed
Fix modinput url split code to work with an IPv6 address
this uses the same code as custom search commands
1 parent 022037b commit 4c2ae3b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

splunklib/modularinput/script.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def run_script(self, args, event_writer, input_stream):
9898

9999
return 1
100100
else:
101-
err_string = "ERROR Invalid arguments to modular input script:" + ' '.join(args)
101+
err_string = "ERROR Invalid arguments to modular input script:" + ' '.join(
102+
args)
102103
event_writer._err.write(err_string)
103104

104105
except Exception as e:
@@ -129,13 +130,14 @@ def service(self):
129130
splunkd_uri = self._input_definition.metadata["server_uri"]
130131
session_key = self._input_definition.metadata["session_key"]
131132

132-
scheme, netloc, _, _, _ = urlsplit(splunkd_uri, allow_fragments=False)
133-
134-
splunkd_host, splunkd_port = netloc.split(':')
133+
splunkd = urlsplit(splunkd_uri, allow_fragments=False)
135134

136135
self._service = Service(
137-
scheme=scheme, host=splunkd_host, port=splunkd_port,
138-
token=session_key)
136+
scheme=splunkd.scheme,
137+
host=splunkd.hostname,
138+
port=splunkd.port,
139+
token=session_key,
140+
)
139141

140142
return self._service
141143

0 commit comments

Comments
 (0)