Изменена опции --mxhost на --mxmod и --cnhost на --cn в скриптах модификации DNS зоны и DNS записи.

Добавлена дополнительная проверка на несовместимость опций --mxmod и --mx
develop
Самоукин Алексей 15 years ago
parent 83980687dd
commit 5980217263

@ -9875,7 +9875,7 @@ record, 'cname' - canonical name record")
name)")
},
{'progAccess':(16,),
'longOption':"cnhost",
'longOption':"cn",
'optVal':"CNHOST",
'helpChapter':_("Common options"),
'help':_("canonical name (fully qualified host name) for CNAME record")
@ -9949,7 +9949,7 @@ domain name)")
delimited)")
},
{'progAccess':(18,),
'longOption':"mxhost",
'longOption':"mxmod",
'optVal':"MAIL_SERVERS",
'helpChapter':_("Common options"),
'help':_("rename old hostname mail server to new hostname mail server \
@ -10089,7 +10089,7 @@ reverse zone")
delimited)")
},
{'progAccess':(21,),
'longOption':"mxhost",
'longOption':"mxmod",
'optVal':"MAIL_SERVERS",
'helpChapter':_("Common options"),
'help':_("rename old hostname mail server to new hostname mail server \
@ -15925,6 +15925,11 @@ this DNS server')%nameServer)
if not self.searchZoneInLDAP(zoneName):
self.printERROR(_("Can not found master zone %s in LDAP")%zoneName)
return False
# Проверка на mx совместно с mxmod
if options.has_key('mx') and options.has_key('mxmod'):
self.printERROR('Command line option "-mx" is incompatible \
with option "--mxmod"')
return False
# MX серверы
mxServers = []
if options.has_key('mx'):
@ -15935,14 +15940,14 @@ this DNS server')%nameServer)
# modMxServers[0] - cтарая запись
# modMxServers[1] - новая запись
modMxServers = []
if options.has_key('mxhost'):
if options.has_key('mxmod'):
modMxServers=map(lambda x: delDot(x.lower()),\
options['mxhost'].split(","))
options['mxmod'].split(","))
modMxServers = self._unicList(modMxServers)
if len(modMxServers)!=2:
self.printERROR(_('Incorrect command line options "--mxhost"'))
self.printERROR(_('Incorrect command line options "--mxmod"'))
self.printWARNING(_("Example") + ":")
self.printWARNING("--mxhost old.mail.host,new.mail.host")
self.printWARNING("--mxmod old.mail.host,new.mail.host")
return False
# ip зоны
zoneIP = ""
@ -16185,7 +16190,11 @@ incorrect, use "--automod on" or "--automod off"')%autoMod)
self.printWARNING(_("Supported record types: %s")\
%", ".join(supportTypes))
return False
# Проверка на mx совместно с mxmod
if options.has_key('mx') and options.has_key('mxmod'):
self.printERROR('Command line option "-mx" is incompatible \
with option "--mxmod"')
return False
# Добавляем кавычки и --
addQ = lambda y: map(lambda x: len(x)>1 and '"--%s"'%x or '"-%s"'%x, y)
# Ключи опций
@ -16195,8 +16204,8 @@ incorrect, use "--automod on" or "--automod off"')%autoMod)
# Необязательные опции
optionalOpt = []
# Проверки совместимых опций
if "mxhost" in optKeys:
requiredOpt = ["mxhost"]
if "mxmod" in optKeys:
requiredOpt = ["mxmod"]
optionalOpt = {"t":["mx"]}
typeRec = "mx"
elif "mx" in optKeys:
@ -16224,7 +16233,7 @@ incorrect, use "--automod on" or "--automod off"')%autoMod)
self.printERROR(_("Incorrect command line options %s")\
%", ".join(addQ(optKeys)))
return False
# Проверка обязательных опций
if not set(requiredOpt)<=set(optKeys):
notFoundReqOpt = list(set(requiredOpt)-set(optKeys))
@ -16273,25 +16282,25 @@ incompatible with CNAME record (options "-t")'))
# modMxServers[0] - cтарая запись
# modMxServers[1] - новая запись
modMxServers = []
if options.has_key('mxhost'):
if options.has_key('mxmod'):
# Отключаем модификацию обратной зоны
modOther = False
# Почтовые серверы для доменного имени
if typeRec == "ptr":
self.printERROR(_('Command line options "--mxhost" \
self.printERROR(_('Command line options "--mxmod" \
incompatible with PTR record (options "-t")'))
return False
if typeRec == "cname":
self.printERROR(_('Command line options "--mxhost" \
self.printERROR(_('Command line options "--mxmod" \
incompatible with CNAME record (options "-t")'))
return False
modMxServers=map(lambda x: delDot(x.lower()),\
options['mxhost'].split(","))
options['mxmod'].split(","))
modMxServers = self._unicList(modMxServers)
if len(modMxServers)!=2:
self.printERROR(_('Incorrect command line options "--mxhost"'))
self.printERROR(_('Incorrect command line options "--mxmod"'))
self.printWARNING(_("Example") + ":")
self.printWARNING("--mxhost old.mail.host,new.mail.host")
self.printWARNING("--mxmod old.mail.host,new.mail.host")
return False
cnameServer = ""
if options.has_key('cname'):
@ -17085,7 +17094,7 @@ is incompatible with option "--ip"')
%", ".join(supportTypes))
return False
if typeRec == "cname":
minKeys = ["cnhost","host"]
minKeys = ["cn","host"]
else:
minKeys = ["host","ip"]
if not set(minKeys)<=set(optKeys):
@ -17131,7 +17140,7 @@ incorrect, use "--autoptr on" or "--autoptr off"')%autoPtr)
cnDomainName = ""
cnHostName = ""
cnZoneName = ""
if options.has_key('cnhost'):
if options.has_key('cn'):
if options.has_key('ip'):
self.printERROR(_('Command line options "--ip" incompatible \
with type DNS record CNAME (options "-t")'))
@ -17141,7 +17150,7 @@ with type DNS record CNAME (options "-t")'))
with type DNS record CNAME (options "-t")'))
return False
# Доменное каноническое имя (имя включающее домен) для CNAME
cnDomainName = delDot(options['cnhost'].lower())
cnDomainName = delDot(options['cn'].lower())
# Имя хоста, имя зоны
cnHostName, spl, cnZoneName = cnDomainName.partition(".")
if not cnZoneName:

Loading…
Cancel
Save