diff --git a/management/univention-directory-manager-modules/modules/univention/admincli/admin.py b/management/univention-directory-manager-modules/modules/univention/admincli/admin.py index f3ce119..f3b957e 100755 --- a/management/univention-directory-manager-modules/modules/univention/admincli/admin.py +++ b/management/univention-directory-manager-modules/modules/univention/admincli/admin.py @@ -321,17 +321,18 @@ def object_input(module, object, input, append=None, remove=None): object[key]=[] else: - if type(object[key]) is str: - object[key] = [ object[key] ] - vallist = value - if type(value) is str: - vallist = [ value ] + current_values = [object[key]] if isinstance(object[key], basestring) else list(object[key]) + if value is None: + current_values = [] + else: + vallist = [value] if isinstance(value, basestring) else value - for val in vallist: - if val in object[key]: - object[key].remove(val) - else: - out.append("WARNING: cannot remove %s from %s, value does not exist"%(val,key)) + for val in vallist: + if val in current_values: + current_values.remove(val) + else: + out.append("WARNING: cannot remove %s from %s, value does not exist"%(val,key)) + object[key] = current_values if input: for key, value in input.items(): if module.property_descriptions[key].syntax.name == 'binaryfile': @@ -1258,3 +1259,7 @@ def _doit(arglist): return out + ["OPERATION FAILED"] return out # nearly the only successfull return + +if __name__ == '__main__': + import sys + print '\n'.join(doit(sys.argv))