|
|
|
@ -3915,6 +3915,11 @@ re.M|re.S)
|
|
|
|
|
"""Функция обработки функций в заголовке"""
|
|
|
|
|
return self.applyFuncTemplate(text,nameFileTemplate)
|
|
|
|
|
|
|
|
|
|
def preReturn(self, pathProg):
|
|
|
|
|
"""Действия перед выходом из метода"""
|
|
|
|
|
if pathProg:
|
|
|
|
|
os.chdir(pathProg)
|
|
|
|
|
|
|
|
|
|
def chownConfFile(nameFileConfig, uid, gid, nameFileTemplate,
|
|
|
|
|
checkExists=True):
|
|
|
|
|
"""Изменение владельца конфигурационного файла"""
|
|
|
|
@ -3961,6 +3966,7 @@ re.M|re.S)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
self.closeFiles()
|
|
|
|
|
pathProg = ""
|
|
|
|
|
# Файлы в системе к которым были применены шаблоны
|
|
|
|
|
applyFiles = [nameFileConfig]
|
|
|
|
|
# В случае бинарного типа файла читаем шаблон
|
|
|
|
@ -3979,7 +3985,6 @@ re.M|re.S)
|
|
|
|
|
nameFileTemplate)
|
|
|
|
|
return ([], False)
|
|
|
|
|
|
|
|
|
|
pathProg = ""
|
|
|
|
|
# Родительская директория
|
|
|
|
|
path = optFile["path"]
|
|
|
|
|
|
|
|
|
@ -4154,10 +4159,12 @@ re.M|re.S)
|
|
|
|
|
mode = self.__octToInt(objHeadNew.params['chmod'])
|
|
|
|
|
if mode:
|
|
|
|
|
if not chmodConfFile(pathOldFile, mode, nameFileTemplate):
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
else:
|
|
|
|
|
self.setError(_("False value 'chmod' in template") + ": " +\
|
|
|
|
|
nameFileTemplate)
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
# chown - изменяем владельца и группу
|
|
|
|
|
if objHeadNew.params.has_key("chown"):
|
|
|
|
@ -4172,6 +4179,7 @@ re.M|re.S)
|
|
|
|
|
self.setError(_("Not user in this system: ") + strUid)
|
|
|
|
|
self.setError(_("False value 'chown' in template") +\
|
|
|
|
|
": "+ nameFileTemplate)
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
try:
|
|
|
|
|
import grp
|
|
|
|
@ -4180,17 +4188,21 @@ re.M|re.S)
|
|
|
|
|
self.setError(_("Not group in this system: ")+strGid)
|
|
|
|
|
self.setError(_("False value 'chown' in template") +\
|
|
|
|
|
": "+ nameFileTemplate)
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
# Изменяем владельца файла
|
|
|
|
|
if not chownConfFile(pathOldFile,uid,gid,nameFileTemplate):
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
else:
|
|
|
|
|
self.setError(_("False value 'chown' in template") + ": " +\
|
|
|
|
|
nameFileTemplate)
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
else:
|
|
|
|
|
self.setError(_("False value 'chown' in template") + ": " +\
|
|
|
|
|
nameFileTemplate)
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
|
|
|
|
|
self.openFiles(nameFileTemplate, pathOldFile)
|
|
|
|
@ -4202,6 +4214,7 @@ re.M|re.S)
|
|
|
|
|
# Изменяем владельца файла
|
|
|
|
|
if not chownConfFile(pathOldFile, self.uid, self.gid,
|
|
|
|
|
nameFileTemplate, checkExists=False):
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
if flagSymlink:
|
|
|
|
|
if os.path.exists(prevOldFile) or os.path.islink(prevOldFile):
|
|
|
|
@ -4217,6 +4230,7 @@ re.M|re.S)
|
|
|
|
|
nameFileTemplate)
|
|
|
|
|
self.setError(_("Can not delete file") + ": " +\
|
|
|
|
|
prevOldFile)
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
if not "/" == pathOldFile[0]:
|
|
|
|
|
applyFiles = [prevOldFile,os.path.join(pathLink,pathOldFile)]
|
|
|
|
@ -4229,10 +4243,10 @@ re.M|re.S)
|
|
|
|
|
nameFileTemplate)
|
|
|
|
|
self.setError(_("Can not create symbolic link") + " :" +\
|
|
|
|
|
"%s -> %s"%(prevOldFile, pathOldFile))
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
if not objHeadNew.body.strip():
|
|
|
|
|
if pathProg:
|
|
|
|
|
os.chdir(pathProg)
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
else:
|
|
|
|
|
applyFiles = [pathOldFile]
|
|
|
|
@ -4242,10 +4256,12 @@ re.M|re.S)
|
|
|
|
|
if typeAppendTemplate == "replace" and\
|
|
|
|
|
not objHeadNew.params.has_key("symbolic") and\
|
|
|
|
|
objHeadNew.params.has_key("link"):
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return ([], False)
|
|
|
|
|
if not pathOldFile in self.dictProcessedTemplates:
|
|
|
|
|
self.dictProcessedTemplates[pathOldFile] = []
|
|
|
|
|
self.dictProcessedTemplates[pathOldFile].append(nameFileTemplate)
|
|
|
|
|
preReturn(pathProg)
|
|
|
|
|
return (applyFiles, objHeadNew)
|
|
|
|
|
|
|
|
|
|
def createNewClass(self, name, bases, attrs={}):
|
|
|
|
|