mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2018.3' into optimize-firewalld-state
This commit is contained in:
commit
f2896180cf
1 changed files with 6 additions and 13 deletions
|
@ -402,18 +402,14 @@ def add(connect_spec, dn, attributes):
|
|||
# convert the "iterable of values" to lists in case that's what
|
||||
# addModlist() expects (also to ensure that the caller's objects
|
||||
# are not modified)
|
||||
attributes = dict(((attr, list(vals))
|
||||
attributes = dict(((attr, salt.utils.data.encode(list(vals)))
|
||||
for attr, vals in six.iteritems(attributes)))
|
||||
log.info('adding entry: dn: %s attributes: %s', repr(dn), repr(attributes))
|
||||
|
||||
if 'unicodePwd' in attributes:
|
||||
attributes['unicodePwd'] = [_format_unicode_password(x) for x in attributes['unicodePwd']]
|
||||
|
||||
modlist = salt.utils.data.decode(
|
||||
ldap.modlist.addModlist(attributes),
|
||||
to_str=True,
|
||||
preserve_tuples=True
|
||||
)
|
||||
modlist = ldap.modlist.addModlist(attributes),
|
||||
try:
|
||||
l.c.add_s(dn, modlist)
|
||||
except ldap.LDAPError as e:
|
||||
|
@ -572,19 +568,16 @@ def change(connect_spec, dn, before, after):
|
|||
# convert the "iterable of values" to lists in case that's what
|
||||
# modifyModlist() expects (also to ensure that the caller's dicts
|
||||
# are not modified)
|
||||
before = dict(((attr, list(vals))
|
||||
before = dict(((attr, salt.utils.data.encode(list(vals)))
|
||||
for attr, vals in six.iteritems(before)))
|
||||
after = dict(((attr, list(vals))
|
||||
after = dict(((attr, salt.utils.data.encode(list(vals)))
|
||||
for attr, vals in six.iteritems(after)))
|
||||
|
||||
if 'unicodePwd' in after:
|
||||
after['unicodePwd'] = [_format_unicode_password(x) for x in after['unicodePwd']]
|
||||
|
||||
modlist = salt.utils.data.decode(
|
||||
ldap.modlist.modifyModlist(before, after),
|
||||
to_str=True,
|
||||
preserve_tuples=True
|
||||
)
|
||||
modlist = ldap.modlist.modifyModlist(before, after)
|
||||
|
||||
try:
|
||||
l.c.modify_s(dn, modlist)
|
||||
except ldap.LDAPError as e:
|
||||
|
|
Loading…
Add table
Reference in a new issue