Skip to content

Commit b4fc25f

Browse files
author
Fred Ross
committed
Entity.update(name=…) throws an error.
1 parent 3fca0c4 commit b4fc25f

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎splunklib/client.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,18 @@ def state(self):
391391
return self._state
392392

393393
def update(self, **kwargs):
394-
"""Updates the entity with the arguments you provide."""
394+
"""Updates the entity with the arguments you provide.
395+
396+
Note that you cannot update the ``name`` field of an Entity,
397+
due to a peculiarity of the REST API.
398+
"""
399+
# The peculiarity in question: the REST API creates a new
400+
# Entity if we pass name in the dictionary, instead of the
401+
# expected behavior of updating this Entity. Therefore we
402+
# check for 'name' in kwargs and throw an error if it is
403+
# there.
404+
if 'name' in kwargs:
405+
raise ValueError("Cannot update the name of an Entity via the REST API.")
395406
self.post(**kwargs)
396407
return self
397408

0 commit comments

Comments
 (0)