-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hec endpoint issue #419
Hec endpoint issue #419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just need a little more context for what the change is doing and how other paths are affected.
splunklib/client.py
Outdated
@@ -842,6 +844,8 @@ def post(self, path_segment="", owner=None, app=None, sharing=None, **query): | |||
if path_segment.startswith('/'): | |||
path = path_segment | |||
else: | |||
if not self.path.endswith('/') and path_segment != "": | |||
self.path = self.path if path_segment.startswith('/') else self.path + '/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the fix? I'm not quite sure just by looking at this line why the path starting with /
here if path_segment.startswith('/')
would have an affect on whether an ending /
would be needed and this line seems to be adding a /
slash whereas line 727 was seemingly doing the same before? In general it's nice to get some sort of writeup (a few sentences) in the PR summary as to what was broken before and how the behavior changed. For this case you could give an example of how the old path was formed and what the new HEC path is now and how other paths are affected after this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously /
was added always for all the paths irrespective of the path_segment, hence the resulting path was always path = path + /
which failed for the HEC as /services/collector/event/
results in 404,
Now /
will be added only when path_segment
is present so that the resulting path = path + / + path_segment
and if there is no path_segment then the resulting path = path
Now the /
is added conditionally and hence removed from line 727
I will add some comments and also add a test case for the HEC and update the PR
removed commented code
Fix for the Issue #345
Previously
path
was always updated topath + /
This implementation fails while using the endpoint
/services/collector/event
as/services/collector/event/
results in 404The fix removes the hard coded addition of the
/
to all the paths, and it makes it conditional based on the presence of thepath_segment
for theget/post
actions. Ifpath_segment' exists the
pathwill be updated to
path + / `