|
|
|
@ -2226,7 +2226,6 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
if self._servDir[-1] != "/":
|
|
|
|
|
self._servDir += "/"
|
|
|
|
|
self._servDir = os.path.split(self._servDir)[0]
|
|
|
|
|
|
|
|
|
|
# Преобразование восьмеричного в целое (ввод строка, вывод число)
|
|
|
|
|
def __octToInt(self, strOct):
|
|
|
|
|
if strOct:
|
|
|
|
@ -6237,4 +6236,62 @@ class dhcp(bind):
|
|
|
|
|
reSeparator = re.compile("[ \t]+")
|
|
|
|
|
|
|
|
|
|
def __init__(self,text):
|
|
|
|
|
bind.__init__(self,text)
|
|
|
|
|
bind.__init__(self,text)
|
|
|
|
|
|
|
|
|
|
def setDataField(self, txtLines, endtxtLines):
|
|
|
|
|
"""Создаем список объектов с переменными"""
|
|
|
|
|
class fieldData:
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.name = False
|
|
|
|
|
self.value = False
|
|
|
|
|
self.comment = False
|
|
|
|
|
self.br = False
|
|
|
|
|
fields = []
|
|
|
|
|
field = fieldData()
|
|
|
|
|
z = 0
|
|
|
|
|
for k in txtLines:
|
|
|
|
|
textLine = k + endtxtLines[z]
|
|
|
|
|
z += 1
|
|
|
|
|
findComment = self.reComment.search(textLine)
|
|
|
|
|
if not textLine.strip():
|
|
|
|
|
field.br = textLine
|
|
|
|
|
fields.append(field)
|
|
|
|
|
field = fieldData()
|
|
|
|
|
elif findComment:
|
|
|
|
|
field.comment = textLine
|
|
|
|
|
fields.append(field)
|
|
|
|
|
field = fieldData()
|
|
|
|
|
else:
|
|
|
|
|
pars = textLine.strip()
|
|
|
|
|
nameValue = self.reSeparator.split(pars)
|
|
|
|
|
if len (nameValue) == 1:
|
|
|
|
|
field.name = textLine.replace(self.sepFields,"").strip()
|
|
|
|
|
field.value = ""
|
|
|
|
|
field.br = textLine
|
|
|
|
|
fields.append(field)
|
|
|
|
|
field = fieldData()
|
|
|
|
|
|
|
|
|
|
if len(nameValue) > 2:
|
|
|
|
|
if nameValue[0] == "option" or nameValue[0] == "hardware":
|
|
|
|
|
valueList = nameValue[2:]
|
|
|
|
|
nameValue =[nameValue[0]+nameValue[1],
|
|
|
|
|
" ".join(valueList).replace(\
|
|
|
|
|
self.sepFields,"")]
|
|
|
|
|
else:
|
|
|
|
|
valueList = nameValue[1:]
|
|
|
|
|
nameValue =[nameValue[0]," ".join(valueList).replace(\
|
|
|
|
|
self.sepFields,"")]
|
|
|
|
|
if len(nameValue) == 2:
|
|
|
|
|
name = nameValue[0]
|
|
|
|
|
value = nameValue[1].replace(self.sepFields,"")
|
|
|
|
|
field.name = name.replace(" ","").replace("\t","")
|
|
|
|
|
field.value = value
|
|
|
|
|
field.br = textLine
|
|
|
|
|
fields.append(field)
|
|
|
|
|
field = fieldData()
|
|
|
|
|
return fields
|
|
|
|
|
|
|
|
|
|
def join(self, dhcpObj):
|
|
|
|
|
"""Объединяем конфигурации"""
|
|
|
|
|
if isinstance(dhcpObj, dhcp):
|
|
|
|
|
self.docObj.joinDoc(dhcpObj.doc)
|
|
|
|
|