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}):