diff options
| author | Martin Basti <mbasti@redhat.com> | 2017-01-31 18:14:33 +0100 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2017-02-10 14:03:04 +0100 |
| commit | d4aa75d10582443b38447985c3fce8e65fcd48a6 (patch) | |
| tree | f3daa3c343fccd55f6e69b313c70b4b734dee7e8 | |
| parent | 8660b9e96801a764e808ca69c3c14a4a019d4eb8 (diff) | |
| download | freeipa-d4aa75d10582443b38447985c3fce8e65fcd48a6.tar.gz freeipa-d4aa75d10582443b38447985c3fce8e65fcd48a6.tar.xz freeipa-d4aa75d10582443b38447985c3fce8e65fcd48a6.zip | |
custodia: kem.set_keys: replace too-broad exception
Exception is too brod and may hide various issues that show up later. If
the code expects that entry may exist, then ldap.ALREADY_EXISTS
exception should be used
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
| -rw-r--r-- | ipaserver/secrets/kem.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/ipaserver/secrets/kem.py b/ipaserver/secrets/kem.py index 5d784b705..28fb4d31b 100644 --- a/ipaserver/secrets/kem.py +++ b/ipaserver/secrets/kem.py @@ -139,8 +139,7 @@ class KEMLdap(iSecLdap): ('memberPrincipal', principal.encode('utf-8')), ('ipaPublicKey', public_key)] conn.add_s(dn, mods) - except Exception: # pylint: disable=broad-except - # This may fail if the entry already exists + except ldap.ALREADY_EXISTS: mods = [(ldap.MOD_REPLACE, 'ipaPublicKey', public_key)] conn.modify_s(dn, mods) |
