diff --git a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py index 0b5a34a95a..5a340f5b14 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py @@ -2050,7 +2050,7 @@ def __modify_dhcp_object(self, position, mac, ip=None): univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'the host "%s" already has a dhcp object, so we search for the next free uv name' % (name)) RE = re.compile(r'cn=[^,]+_uv(\d+),') taken = set(int(m.group(1)) for m in (RE.match(dn) for dn in results) if m) - n = min(set(range(max(taken) + 1)) - taken) if taken else 0 + n = min(set(range(max(taken) + 2)) - taken) if taken else 0 name = '%s_uv%d' % (name, n) dn = 'cn=%s,%s' % (escape_dn_chars(name), position)