diff --git a/customers/8505_lmz/ucs-school-lib/python/models/computer.py b/customers/8505_lmz/ucs-school-lib/python/models/computer.py index ab7b471..f2728dd 100644 @@ -189,6 +190,13 @@ class SchoolComputer(UCSSchoolHelperAbstractClass): network = self.get_network() if network: udm_obj['network'] = network.dn + ipv4_network = self.get_ipv4_network() + if ipv4_network: + if ipv4_network.ip == ipv4_network.network: + # IP is set to network address, replace it + self.ip_address = None + else: + udm_obj['ip'] = str(ipv4_network.ip) # TODO: groups. for memberserver... return super(SchoolComputer, self).do_create(udm_obj, lo) @@ -230,7 +238,8 @@ class SchoolComputer(UCSSchoolHelperAbstractClass): def validate(self, lo, validate_unlikely_changes=False): super(SchoolComputer, self).validate(lo, validate_unlikely_changes) - if self.ip_address: + # don't test existance of IP address if it is the network's address + if self.ip_address and self.get_ipv4_network().ip != self.get_ipv4_network().network: name, ip_address = escape_filter_chars(self.name), escape_filter_chars(self.ip_address) if AnyComputer.get_first_udm_obj(lo, '&(!(cn=%s))(ip=%s)' % (name, ip_address)): self.add_error('ip_address', _('The ip address is already taken by another computer. Please change the ip address.'))