mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07:00
ldap_attr: typecast values to list (#46818)
Adding a value to an attribute or removing a value from an attribute of a LDAP entry throws the exception TypeError: object of type 'filter' has no len()
This commit is contained in:
parent
b772485d97
commit
739a129322
1 changed files with 2 additions and 2 deletions
|
@ -178,7 +178,7 @@ class LdapAttr(LdapGeneric):
|
||||||
self.values = [to_bytes(self.module.params['values'])]
|
self.values = [to_bytes(self.module.params['values'])]
|
||||||
|
|
||||||
def add(self):
|
def add(self):
|
||||||
values_to_add = filter(self._is_value_absent, self.values)
|
values_to_add = list(filter(self._is_value_absent, self.values))
|
||||||
|
|
||||||
if len(values_to_add) > 0:
|
if len(values_to_add) > 0:
|
||||||
modlist = [(ldap.MOD_ADD, self.name, values_to_add)]
|
modlist = [(ldap.MOD_ADD, self.name, values_to_add)]
|
||||||
|
@ -188,7 +188,7 @@ class LdapAttr(LdapGeneric):
|
||||||
return modlist
|
return modlist
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
values_to_delete = filter(self._is_value_present, self.values)
|
values_to_delete = list(filter(self._is_value_present, self.values))
|
||||||
|
|
||||||
if len(values_to_delete) > 0:
|
if len(values_to_delete) > 0:
|
||||||
modlist = [(ldap.MOD_DELETE, self.name, values_to_delete)]
|
modlist = [(ldap.MOD_DELETE, self.name, values_to_delete)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue