Changed validation parameter "--dnsip" for service dhcp

develop
Самоукин Алексей 15 years ago
parent b72bfa1d8e
commit 00a647320f

@ -20043,31 +20043,47 @@ incompatible, use one of the options"))
if not IPs:
self.printERROR(_("Can not found ip in net interfaces"))
return False
# Сети DNS
dnsNetIPs = map(lambda x: x.rpartition(".")[0] ,dnsIPs)
# Сеть range
rangeNetIPs = map(lambda x: x.rpartition(".")[0] ,ranges)
# Проверка соответствия range и ip dns cервера
IPsNetwork = list(set(dnsNetIPs) & set(rangeNetIPs))
if not IPsNetwork:
flagErrorRange = False
isRange = lambda n, minN, maxN: minN<=n<=maxN
minNumber, maxNumber = self.getMinAndMaxIpNumb(net)
for ipRange in ranges:
ipNumb = self.getNumberIP(ipRange)
if not isRange(ipNumb, minNumber, maxNumber):
flagErrorRange = True
break
if flagErrorRange:
self.printERROR(\
_('Command line option "--range %s" incorrectly')\
%",".join(ranges))
self.printERROR(
_("Invalid range of network addresses for the network %s")\
%net)
return False
flagFoundDnsIp = False
for ipDns in dnsIPs:
ipNumb = self.getNumberIP(ipDns)
if isRange(ipNumb, minNumber, maxNumber):
flagFoundDnsIp = True
break
if not flagFoundDnsIp:
self.printERROR(\
_('Command line option "--dnsip %s" incorrectly')\
%dnsIP)
self.printERROR(_("Can not found ip address dns servers in \
network %s")%net)
return False
# Сети интерфейсов
netIPs = map(lambda x: x.rpartition(".")[0], IPs)
netDnsServer = list(set(netIPs) & set(IPsNetwork))
if not netDnsServer:
ipserver = ""
for ipIntr in IPs:
ipNumb = self.getNumberIP(ipIntr)
if isRange(ipNumb, minNumber, maxNumber):
ipserver = ipIntr
break
if not ipserver:
self.printERROR(\
_('Command line option "--dnsip %s" incorrectly')\
%dnsIP)
self.printERROR(_("Can not found DNS server ip in net interfaces"))
_("Ip addresses on the interfaces of the system (%s)")\
%",".join(IPs)+" "+_("does not belong to the network %s")\
%net)
return False
# ip этого DNS сервера
ipserver = filter(lambda x: x.rpartition(".")[0] in netDnsServer,\
IPs)[0]
# опции добавления DNS зоны
optionsDns = {"n":zoneName,
"t":"master",

Loading…
Cancel
Save