From e9b1f0f26fc6f50b59f68670191662f4e8ba7f82 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 19 Dec 2013 18:38:47 +0100 Subject: [PATCH] Add --replace-touch parameter --- check_syncrepl_extended | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/check_syncrepl_extended b/check_syncrepl_extended index b69bfad..6579fa9 100755 --- a/check_syncrepl_extended +++ b/check_syncrepl_extended @@ -129,6 +129,11 @@ parser.add_option( "--touch", help="Touch attribute giving in parameter to force resync a this LDAP object from provider. A value '%s' will be add to this attribute and remove after. The user use to connect to the LDAP directory must have write permission on this attribute on each object." % TOUCH_VALUE, default=None) +parser.add_option( "--replace-touch", + dest="replacetouch", + action="store_true", + help="In touche mode, replace value instead of adding.", + default=False) (options, args) = parser.parse_args() @@ -230,8 +235,11 @@ class LdapServer(object): return [] def touch_object(self,dn,attr,orig_value): - new_value=list(orig_value) - new_value.append(TOUCH_VALUE) + if options.replacetouch: + new_value=[new_value] + else: + new_value=list(orig_value) + new_value.append(TOUCH_VALUE) try: logging.info('Add value "%s" to attribute %s of object %s' % (TOUCH_VALUE,attr,dn)) if self.update_object(dn,{attr: orig_value}, {attr: new_value}):