Skip to content

Commit 396be2e

Browse files
Merge pull request #166 from splunk/feature/input-kindpath-perf-improvement
Feature/input kindpath perf improvement
2 parents bfa6a52 + 4cc3c22 commit 396be2e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

splunklib/client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,15 +2432,12 @@ def kindpath(self, kind):
24322432
:return: The relative endpoint path.
24332433
:rtype: ``string``
24342434
"""
2435-
if kind in self.kinds:
2436-
return UrlEncoded(kind, skip_encode=True)
2437-
# Special cases
2438-
elif kind == 'tcp':
2435+
if kind == 'tcp':
24392436
return UrlEncoded('tcp/raw', skip_encode=True)
24402437
elif kind == 'splunktcp':
24412438
return UrlEncoded('tcp/cooked', skip_encode=True)
24422439
else:
2443-
raise ValueError("No such kind on server: %s" % kind)
2440+
return UrlEncoded(kind, skip_encode=True)
24442441

24452442
def list(self, *kinds, **kwargs):
24462443
"""Returns a list of inputs that are in the :class:`Inputs` collection.

tests/test_input.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ def test_read_kind(self):
131131
def test_inputs_list_on_one_kind(self):
132132
self.service.inputs.list('monitor')
133133

134+
def test_read_invalid_input(self):
135+
name = testlib.tmpname()
136+
try:
137+
self.service.inputs.get(name)
138+
self.fail("Expected a 404 HTTPError")
139+
except HTTPError as he:
140+
self.assertTrue("HTTP 404 Not Found" in str(he))
141+
134142
def test_inputs_list_on_one_kind_with_count(self):
135143
N = 10
136144
expected = [x.name for x in self.service.inputs.list('monitor')[:10]]

0 commit comments

Comments
 (0)