This is an automated email from the git hooks/post-receive script.
spichugi pushed a commit to branch master
in repository lib389.
commit b46da26adbfbf289f4ee02ecf4e76c30e3d5b130
Author: Simon Pichugin <spichugi@redhat.com>
Date: Mon May 15 09:32:58 2017 +0200
Issue 27 - Improve dseldif API
Description: Return None instead of ValueError, if we haven't found
an attribute during a get operation.
During replace operation, if there is no attribute - just log an info.
https://pagure.io/lib389/issue/27
Reviewed by: wibrown (Thanks!)
---
lib389/dseldif.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib389/dseldif.py b/lib389/dseldif.py
index 39e35b2..7e5f6ab 100644
--- a/lib389/dseldif.py
+++ b/lib389/dseldif.py
@@ -49,7 +49,7 @@ class DSEldif(object):
# Find the attribute
for line in entry_slice:
- if line.startswith(attr):
+ if line.startswith("{}:".format(attr)):
attr_value = line.split(" ", 1)[1][:-1]
attr_data.update({entry_slice.index(line): attr_value})
@@ -61,7 +61,10 @@ class DSEldif(object):
def get(self, entry_dn, attr):
"""Return attribute values under a given entry"""
- _, attr_data = self._find_attr(entry_dn, attr)
+ try:
+ _, attr_data = self._find_attr(entry_dn, attr)
+ except ValueError:
+ return None
return attr_data.values()
@@ -89,7 +92,10 @@ class DSEldif(object):
def replace(self, entry_dn, attr, value):
"""Replace attribute values with a new one under a given entry"""
- self.delete(entry_dn, attr)
+ try:
+ self.delete(entry_dn, attr)
+ except ValueError as e:
+ self._instance.log.debug("During replace operation: {}".format(e))
self.add(entry_dn, attr, value)
self._update()
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org
No comments:
Post a Comment