Skip to content

Commit 686cc6f

Browse files
author
Frederick Ross
committed
Resolved comments from David's review.
1 parent 4527a99 commit 686cc6f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

splunklib/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,10 @@ class Input(Entity):
16331633
typed input classes and is also used when the client does not recognize an
16341634
input kind."""
16351635
def __init__(self, service, path, kind=None, **kwargs):
1636+
# kind can be omitted (in which case it is inferred from the path)
1637+
# Otherwise, valid values are the paths from data/inputs ("udp",
1638+
# "monitor", "tcp/raw"), or two special cases: "tcp" (which is "tcp/raw")
1639+
# and "splunktcp" (which is "tcp/cooked").
16361640
Entity.__init__(self, service, path, **kwargs)
16371641
if kind is None:
16381642
path_segments = path.split('/')
@@ -1665,8 +1669,7 @@ def __getitem__(self, key):
16651669
# Fetch a single kind
16661670
kind, key = key
16671671
try:
1668-
kind_path = self.kindpath(kind)
1669-
response = self.get(kind_path + "/" + key)
1672+
response = self.get(self.kindpath(kind) + "/" + key)
16701673
entries = self._load_list(response)
16711674
if len(entries) > 1:
16721675
raise AmbiguousReferenceException("Found multiple inputs of kind %s named %s." % (kind, key))
@@ -1858,8 +1861,7 @@ def list(self, *kinds, **kwargs):
18581861
for kind in kinds:
18591862
response = None
18601863
try:
1861-
response = self.get(self.kindpath(kind),
1862-
search=search)
1864+
response = self.get(self.kindpath(kind), search=search)
18631865
except HTTPError as e:
18641866
if e.status == 404:
18651867
continue # No inputs of this kind

0 commit comments

Comments
 (0)