diff --git a/splunklib/client.py b/splunklib/client.py index 9c7260a57..2acd5d3bf 100644 --- a/splunklib/client.py +++ b/splunklib/client.py @@ -2432,15 +2432,12 @@ def kindpath(self, kind): :return: The relative endpoint path. :rtype: ``string`` """ - if kind in self.kinds: - return UrlEncoded(kind, skip_encode=True) - # Special cases - elif kind == 'tcp': + if kind == 'tcp': return UrlEncoded('tcp/raw', skip_encode=True) elif kind == 'splunktcp': return UrlEncoded('tcp/cooked', skip_encode=True) else: - raise ValueError("No such kind on server: %s" % kind) + return UrlEncoded(kind, skip_encode=True) def list(self, *kinds, **kwargs): """Returns a list of inputs that are in the :class:`Inputs` collection. diff --git a/tests/test_input.py b/tests/test_input.py index 417f76ff5..ddfed8d46 100755 --- a/tests/test_input.py +++ b/tests/test_input.py @@ -131,6 +131,14 @@ def test_read_kind(self): def test_inputs_list_on_one_kind(self): self.service.inputs.list('monitor') + def test_read_invalid_input(self): + name = testlib.tmpname() + try: + self.service.inputs.get(name) + self.fail("Expected a 404 HTTPError") + except HTTPError as he: + self.assertTrue("HTTP 404 Not Found" in str(he)) + def test_inputs_list_on_one_kind_with_count(self): N = 10 expected = [x.name for x in self.service.inputs.list('monitor')[:10]]