Skip to content

Commit

Permalink
Merge pull request #464 from splunk/DVPL-11235
Browse files Browse the repository at this point in the history
updated checks for wildcards in StoragePasswords
  • Loading branch information
akaila-splunk committed Jun 9, 2022
2 parents f11fe6a + ceb6f62 commit 31cf507
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions splunklib/client.py
Expand Up @@ -1846,8 +1846,6 @@ class StoragePasswords(Collection):
instance. Retrieve this collection using :meth:`Service.storage_passwords`.
"""
def __init__(self, service):
if service.namespace.owner == '-' or service.namespace.app == '-':
raise ValueError("StoragePasswords cannot have wildcards in namespace.")
super(StoragePasswords, self).__init__(service, PATH_STORAGE_PASSWORDS, item=StoragePassword)

def create(self, password, username, realm=None):
Expand All @@ -1865,6 +1863,9 @@ def create(self, password, username, realm=None):
:return: The :class:`StoragePassword` object created.
"""
if self.service.namespace.owner == '-' or self.service.namespace.app == '-':
raise ValueError("While creating StoragePasswords, namespace cannot have wildcards.")

if not isinstance(username, six.string_types):
raise ValueError("Invalid name: %s" % repr(username))

Expand Down Expand Up @@ -1896,6 +1897,9 @@ def delete(self, username, realm=None):
:return: The `StoragePassword` collection.
:rtype: ``self``
"""
if self.service.namespace.owner == '-' or self.service.namespace.app == '-':
raise ValueError("app context must be specified when removing a password.")

if realm is None:
# This case makes the username optional, so
# the full name can be passed in as realm.
Expand Down

0 comments on commit 31cf507

Please sign in to comment.