Add --replace-touch parameter
Benjamin Renard

Benjamin Renard commited on 2013-12-19 17:38:47
Showing 1 changed files, with 8 additions and 0 deletions.

... ...
@@ -129,6 +129,11 @@ parser.add_option(	"--touch",
129 129
 			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,
130 130
 			default=None)
131 131
 
132
+parser.add_option(	"--replace-touch",
133
+			dest="replacetouch",
134
+			action="store_true",
135
+			help="In touche mode, replace value instead of adding.",
136
+			default=False)
132 137
 
133 138
 (options, args) = parser.parse_args()
134 139
 
... ...
@@ -230,6 +235,9 @@ class LdapServer(object):
230 235
 		return []
231 236
 
232 237
 	def touch_object(self,dn,attr,orig_value):
238
+		if options.replacetouch:
239
+			new_value=[new_value]
240
+		else:
233 241
 			new_value=list(orig_value)
234 242
 			new_value.append(TOUCH_VALUE)
235 243
 		try:
236 244