splunk / splunk-sdk-python

Splunk Software Development Kit for Python
http://dev.splunk.com
Apache License 2.0
698 stars 370 forks source link

some kvstore.data methods fail if _key has '/' #361

Closed pmeyerson closed 3 years ago

pmeyerson commented 3 years ago

Describe the bug If record key has "/" the update method fails, but insert, query, and delete methods succeed.

This doesn't seem like it should be expected but let me know if it is.

To Reproduce Steps to reproduce the behavior:

service.kvstore.create("test")
col = service.kvstore['test']
bad_key = "01:/i-001"
record = json.dumps({"_key":bad_key, "foo":"bar"})
record_update = json.dumps({"foo":"baz"})
query_key=json.dumps({"_key": bad_key})

# insert succeeds
col.data.insert(record)

# update fails
col.data.update(bad_key, record_update)

# query_by_id fails with 404
col.data.query_by_id(bad_key)

# regular query succeeds
col.data.query(query_key)

# delete_by_id fails with 404
col.data.delete_by_id(bad_key)

# delete succeeds
col.data.delete(query_key)
print(col.data.query())

Expected behavior

To my understanding all these calls should succeed - the inconsistency is very confusing. None of these calls should return HTTP 404 All statements succeed if bad_key does not contain "/"

Splunk (please complete the following information):

SDK (please complete the following information):

pmeyerson commented 3 years ago

I believe this is the issue initially reported by syrad #232

vmalaviya-splunk commented 3 years ago

Greetings @pmeyerson Thanks for bringing it up We have fixed the issue, and the changes will be available in the next release. Reference to PR

pmeyerson commented 3 years ago

Thanks, looking forward to checking it out!

ashah-splunk commented 3 years ago

Hi @pmeyerson , we have a new SDK release 1.6.17 with the fix. Would request you to try with the latest SDK version. Let us know in case if you still face the issue.

pmeyerson commented 3 years ago

confirm working as expected, thank you!