splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

Adding parameters to Users.create

Open parhamfh opened this issue 14 years ago • 1 comments

I am working on Helmuts Users manager and I noticed something. To create a user you need to specify password as well as roles. This can be done in the kwargs, but shouldn't these be positional arguments? I think that if the method breaks when arguments are not provided in kwargs they should be.

Example response is:

Traceback (most recent call last): File "./usermanager.htest.py", line 20, in splunk.users.create_user('Khorde', 'testar') File "/Users/phashemi/gitdepot/splunk-helmut/helmut/manager/users/sdk/init.py", line 29, in create_user self.connector.service.users.create(username, *_kwargs)) File "/Users/phashemi/gitdepot/splunk-helmut/helmut/contrib/splunk-sdk-python/splunklib/client.py", line 1004, in create return Collection.create(self, name.lower(), *_kwargs) File "/Users/phashemi/gitdepot/splunk-helmut/helmut/contrib/splunk-sdk-python/splunklib/client.py", line 450, in create self.post(name=name, *_kwargs) File "/Users/phashemi/gitdepot/splunk-helmut/helmut/contrib/splunk-sdk-python/splunklib/client.py", line 309, in post return self.service.post("%s%s" % (self.path, relpath), *_kwargs) File "/Users/phashemi/gitdepot/splunk-helmut/helmut/contrib/splunk-sdk-python/splunklib/binding.py", line 185, in post return self.http.post(self.url(path), self._headers(), **kwargs) File "/Users/phashemi/gitdepot/splunk-helmut/helmut/contrib/splunk-sdk-python/splunklib/binding.py", line 372, in post return self.request(url, message) File "/Users/phashemi/gitdepot/splunk-helmut/helmut/contrib/splunk-sdk-python/splunklib/binding.py", line 378, in request raise HTTPError(response) splunklib.binding.HTTPError: HTTP 400 Bad Request -- In handler 'users': Users must be given at least one role

parhamfh avatar May 15 '12 11:05 parhamfh

Agreed. I've fixed this in my development branch.

madhadron avatar May 21 '12 18:05 madhadron