I am trying to delete all data from an index for automated testing using the python sdk. The splunk.client.index.clean works intermittently but times out often. I seen this question: where in the last comment gblock [Splunk] suggest not using the clean function but delete the index and recreate instead. I have tried this in the below code function but when I try to recreate, I get an error saying
HTTPError: HTTP 404 Not Found -- Index "testindex" is being deleted; name still unavailable
service = splunkconnection.get()
if index.state.content.disabled == 1:
name = index.name
the user is created as follows.
/opt/splunk/bin/splunk add user usernasme -password password -role admin -auth admin:changeme'