diff --git a/pym/cl_profile.py b/pym/cl_profile.py index b948902..9f51ab3 100644 --- a/pym/cl_profile.py +++ b/pym/cl_profile.py @@ -2876,7 +2876,7 @@ class profile(_file, _terms, xmlShare): dirObjsApply = [] for dirObj in dirObjs: dirInfoFile = os.path.join(dirObj.baseDir, self.profDirNameFile) - ret = self.__getApplyHeadDirRoot(dirInfoFile) + ret = self.__isApplyHeadDir(dirInfoFile) if ret: dirObjsApply.append(dirObj) else: @@ -3019,7 +3019,7 @@ class profile(_file, _terms, xmlShare): textProfile = FD.read() FD.close() except: - self.setError(_("Error open profile#: " ) +\ + self.setError(_("Error open profile: " ) +\ profileDirFile) return (applyDir, False) objHead = dirHeader(textProfile, self.objVar,function) @@ -3083,7 +3083,7 @@ class profile(_file, _terms, xmlShare): dirObjsApply = [] for dirObj in dirObjs: dirInfoFile = os.path.join(dirObj.baseDir, self.profDirNameFile) - ret = self.__getApplyHeadDirRoot(dirInfoFile) + ret = self.__isApplyHeadDir(dirInfoFile) if ret: dirObjsApply.append(dirObj) else: @@ -3172,7 +3172,7 @@ class profile(_file, _terms, xmlShare): return False return filesApply - def __getApplyHeadDirRoot(self, profileDirFile): + def __isApplyHeadDir(self, profileDirFile): """Будет ли применен профиль корневой директории Возвращает True, False @@ -3189,9 +3189,12 @@ class profile(_file, _terms, xmlShare): textProfile = FD.read() FD.close() except: - self.setError(_("Error open profile#: " ) +\ + self.setError(_("Error open profile: " ) +\ profileDirFile) return False + # Заменяем переменные на их значения + textProfile = self.applyVarsProfile(textProfile, profileDirFile) + # Обработка заголовка objHead = dirHeader(textProfile, self.objVar,function) if not objHead.headerCorrect: self.setError(_("Incorrect profile: " ) +\ @@ -3267,9 +3270,12 @@ class profile(_file, _terms, xmlShare): textProfile = FD.read() FD.close() except: - self.setError(_("Error open profile#: " ) +\ + self.setError(_("Error open profile: " ) +\ profileDirFile) return (applyDir, False) + # Заменяем переменные на их значения + textProfile = self.applyVarsProfile(textProfile, profileDirFile) + # Обработка заголовка objHead = dirHeader(textProfile, self.objVar,function) if not objHead.headerCorrect: self.setError(_("Incorrect profile: " ) +\ @@ -6210,4 +6216,25 @@ the same nodes at one level") except: self.setError(_("Can not join profile")) return False - return True \ No newline at end of file + return True + + +class dhcp(bind): + """Класс для обработки конфигурационного файла типа dhcp + + """ + _comment = "#" + configName = "dhcp" + configVersion = "0.1" + __openArea = "{" + __closeArea = "[ \t]*\}[ \t]*" + sepFields = ";" + reOpen = re.compile(__openArea) + reClose = re.compile(__closeArea) + reCloseArea = re.compile(__closeArea + "\s*\Z") + reComment = re.compile("^[ \t]*%s"%(_comment)) + reSepFields = re.compile(sepFields) + reSeparator = re.compile("[ \t]+") + + def __init__(self,text): + bind.__init__(self,text) \ No newline at end of file