lxml changes

py3_forced
parent e70baedc10
commit 0642ae894b

@ -25,13 +25,14 @@ import types
import string
#import os
import filecmp
import ConfigParser
# import ConfigParser
import time
import socket
#import sys
import random
import string
from . import cl_utils
from .cl_xml import firstChild
##############################################################################
_expand_lang = gettext._expand_lang
@ -389,14 +390,14 @@ class iniParser(cl_profile._error):
return self.checkIni
allAreas = objIni.docObj.getAllAreas()
for xmlArea in allAreas:
parentNode = xmlArea.parentNode
if parentNode and parentNode.tagName == "area":
parentNode = xmlArea.getparent()
if parentNode is not None and parentNode.tagName == "area":
self.checkIni = "plasma"
break
if self.checkIni == "samba":
objIni = cl_profile.samba(textIni)
xmlBody = objIni.docObj.getNodeBody()
if not xmlBody.firstChild:
if firstChild(xmlBody) is None:
self.checkIni = False
return self.checkIni
@ -539,12 +540,12 @@ class iniParser(cl_profile._error):
nSect = objIni.docObj.getNameArea(xmlNode)
if nSect:
namesSect = [nSect]
parentNode = xmlNode.parentNode
parentNode = xmlNode.getparent()
while parentNode != objIni.docObj.body:
nameSect = objIni.docObj.getNameArea(parentNode)
if nameSect:
if nameSect is not None:
namesSect.append(nameSect)
parentNode = parentNode.parentNode
parentNode = parentNode.getparent()
else:
return []
namesSection.append(",".join(reversed(namesSect)))
@ -1103,9 +1104,9 @@ class DataVars():
def printVars(self,type_names=None):
var=None
var=self.getVars(type_names)
mlen_name=0;
mlen_type=0;
mlen_mode=0;
mlen_name=0
mlen_type=0
mlen_mode=0
for i,j in var.items():
if len(i)>mlen_name:
mlen_name=len(i)
@ -1145,6 +1146,9 @@ class DataVars():
#mlen_type,
p_val)
print(br)
##############################################################################
class glob_attr:
"""Глобальные аттрибуты для методов заполнения переменных"""

@ -1,5 +1,3 @@
#-*- coding: utf-8 -*-
# Copyright 2008-2010 Mir Calculate. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -18,7 +16,8 @@ import os
import sys
import re
import ldap
import cStringIO, StringIO
# import cStringIO, StringIO
from io import StringIO, BytesIO
from ldif import LDIFParser, LDIFWriter
from . import cl_base
from . import cl_profile
@ -41,14 +40,12 @@ import tempfile
# Вывод в строку ввода
import readline
# Пути в XML документе
from xml import xpath
# from xml import xpath
from .cl_xml import xpath, firstChild
# Для 32 битного целого (генерация серийного номера DNS зоны)
import ctypes
from functools import reduce
#TODO delete this
_ = lambda x: x
Version = "calculate-server 2.1.20"
tr = cl_base.lang()
@ -136,7 +133,7 @@ class report:
for i in range(lenLines):
char = " | "
if i == 0 or i == 2 or i == lenLines-1:
char ="-+-"
char = "-+-"
convLines.append(self._insertStrChar(lines[i], lenCols, char))
print("\n".join(convLines))
print("(%s %s)"%(len(self.dataList), _("rows")))
@ -200,7 +197,7 @@ class iniLdapParser(cl_base.iniParser):
class addLdif(LDIFParser):
"""Класс необходимый для добавления записей в LDAP"""
def __init__(self, strInput,ldapCon):
FD = cStringIO.StringIO(strInput)
FD = StringIO(strInput)
LDIFParser.__init__(self, FD)
self.ldapCon = ldapCon
@ -677,17 +674,17 @@ in a sambaDomainName',
%delBackDir)
return True
def stringIsJpeg(self, string):
"""Определяет является ли строка jpeg изображением"""
if len(string)<8:
def dataIsJpeg(self, bytes):
"""Определяет является ли набор байтов jpeg изображением"""
if len(bytes)<8:
return False
FD = cStringIO.StringIO(string)
FD = BytesIO(bytes)
isJpeg = False
FD.seek(0, 0)
(firstByte, secondByte) = FD.read(2)
if (ord(firstByte) == 0xff and ord(secondByte) == 0xd8):
if (firstByte == 0xff and secondByte == 0xd8):
(firstByte, secondByte) = FD.read(2)
if (ord(firstByte) == 0xff and ord(secondByte) == 0xe0):
if (firstByte == 0xff and secondByte == 0xe0):
isJpeg = True
return isJpeg
@ -1122,7 +1119,7 @@ in a sambaDomainName',
"""Добавляем jpeg фотографию пользователя в LDAP"""
import subprocess
try:
FD = open(photoPath)
FD = open(photoPath, "rb")
photoData = FD.read()
FD.close()
except:
@ -1134,7 +1131,7 @@ in a sambaDomainName',
_("not found"))
return False
modAttrs = []
if not self.stringIsJpeg(photoData):
if not self.dataIsJpeg(photoData):
if self.execProg("which convert") is False:
self.printERROR(_("Can not found package imagemagick"))
return False
@ -1155,7 +1152,7 @@ in a sambaDomainName',
fErr.close()
if not flagError:
photoData = fOut.read()
if not self.stringIsJpeg(photoData):
if not self.dataIsJpeg(photoData):
self.printERROR(\
_("Can not convert file '%s' in jpeg format") %photoPath)
flagError = True
@ -14445,7 +14442,7 @@ class cl_info(cl_utils2.cl_smartcon, prnServ):
if xmlNodes:
masterIPNode = xmlNodes[0]
xmlNodes = xpath.Evaluate( "child::value", masterIPNode)
ips = (x.firstChild.nodeValue.strip() for x in xmlNodes)
ips = (firstChild(x).nodeValue.strip() for x in xmlNodes)
flagAddIPs = True
slaveIPs.append(",".join(ips))
if not flagAddIPs:
@ -14510,7 +14507,7 @@ class cl_info(cl_utils2.cl_smartcon, prnServ):
if xmlNodes:
masterIPNode = xmlNodes[0]
xmlNodes = xpath.Evaluate( "child::value", masterIPNode)
ipMasterServers = [x.firstChild.nodeValue.strip() for x in xmlNodes]
ipMasterServers = [firstChild(x).nodeValue.strip() for x in xmlNodes]
if not ipMasterServers:
self.printERROR(_("The program does not support information \
for %s DNS zone")%zoneName)
@ -16460,9 +16457,9 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
if not namesArea:
return []
return [x for x in namesArea
if x.firstChild and x.firstChild.nodeValue and\
len(x.firstChild.nodeValue) > 4 and\
'host' in x.firstChild.nodeValue[:4]]
if firstChild(x) is not None and firstChild(x).nodeValue and\
len(firstChild(x).nodeValue) > 4 and\
'host' in firstChild(x).nodeValue[:4]]
def getAllXMLSubnet(self):
"""Получаем все XML ноды подсетей"""
@ -16474,16 +16471,16 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
if not namesArea:
return []
return [x for x in namesArea
if x.firstChild and x.firstChild.nodeValue and\
len(x.firstChild.nodeValue) > 6 and\
'subnet' in x.firstChild.nodeValue[:6]]
if firstChild(x) is not None and firstChild(x).nodeValue and\
len(firstChild(x).nodeValue) > 6 and\
'subnet' in firstChild(x).nodeValue[:6]]
def getDataInAllHost(self):
"""Получить информацию о статических хостах"""
if self.getError():
return False
allXmlNames = self._getAllXMLStaticHosts()
allXmlAreas = [x.parentNode.parentNode for x in allXmlNames]
allXmlAreas = [x.getparent().getparent() for x in allXmlNames]
# Информация
dataHost = []
iterXmlNames = iter(allXmlNames)
@ -16491,9 +16488,9 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
#print xmlArea.toprettyxml()
# Ност
xmlNodeName = next(iterXmlNames)
strNameNode = xmlNodeName.firstChild.nodeValue
strNameNode = firstChild(xmlNodeName).nodeValue
# название хоста
hostname = strNameNode.partition("host")[2].strip().encode("UTF-8")
hostname = strNameNode.partition("host")[2].strip()
# Параметры статического хоста
dataPars = self.dataParsHost.copy()
# Заполняем словарь dataPars реальными параметрами
@ -16507,7 +16504,7 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
if self.getError():
return False
allXmlNames = self.getAllXMLSubnet()
allXmlAreas = [x.parentNode.parentNode for x in allXmlNames]
allXmlAreas = [x.getparent().getparent() for x in allXmlNames]
# Информация
dataNet = []
iterXmlNames = iter(allXmlNames)
@ -16515,13 +16512,13 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
# Сеть
xmlNodeName = next(iterXmlNames)
# Название области
strNameNode = xmlNodeName.firstChild.nodeValue
strNameNode = firstChild(xmlNodeName).nodeValue
# ip сети
netIP = strNameNode.partition("subnet")[2].partition("netmask")[0]
netIP = netIP.encode("UTF-8")
# netIP = netIP.encode("UTF-8")
# Маска сети
netMask = strNameNode.partition("subnet")[2].partition("netmask")[2]
netMask = netMask.encode("UTF-8")
# netMask = netMask.encode("UTF-8")
# Параметры сети
dataPars = self.dataParsNet.copy()
# Заполняем словарь dataPars реальными параметрами
@ -16569,9 +16566,9 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
for node in nodesFind:
nodesXml = xpath.Evaluate("child::value", node)
for nodeFind in nodesXml:
if nodeFind.firstChild:
listOpt = [x.encode("UTF-8") for x
in nodeFind.firstChild.nodeValue.replace("\t"," ").split(" ") if x]
if firstChild(nodeFind) is not None:
listOpt = [x for x
in firstChild(nodeFind).nodeValue.replace("\t"," ").split(" ") if x]
dataPars[opt] = listOpt
return dataPars
@ -16585,8 +16582,8 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
if not xmlStaticHosts:
return []
slpHostName = 'host%s' %hostName.lower()
return [x.parentNode.parentNode for x in xmlStaticHosts
if slpHostName == x.firstChild.nodeValue.lower()]
return [x.getparent().getparent() for x in xmlStaticHosts
if slpHostName == firstChild(x).nodeValue.lower()]
def getXMLNet(self, net):
"""Получить XML ноду подсети по ip"""
@ -16598,9 +16595,9 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
return []
slpNetName = 'subnet%s' %net.lower()
lenSlpNetName = len(slpNetName)
return [x.parentNode.parentNode for x in xmlSubnets
if len(x.firstChild.nodeValue) > lenSlpNetName and
slpNetName == x.firstChild.nodeValue[:lenSlpNetName].lower()]
return [x.getparent().getparent() for x in xmlSubnets
if len(firstChild(x).nodeValue) > lenSlpNetName and
slpNetName == firstChild(x).nodeValue[:lenSlpNetName].lower()]
def createStaticHost(self, hostname, ip, mac):
"""Создает статический хост в файле конфигурации dhcp"""
@ -16611,7 +16608,7 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
xmlNodeBodyNewNet = dhcpObj.docObj.getNodeBody()
namesAreaNew = xpath.Evaluate("child::area/child::caption/child::name",
xmlNodeBodyNewNet)
splNameNewNode = namesAreaNew[0].firstChild.nodeValue
splNameNewNode = firstChild(namesAreaNew[0]).nodeValue
hostnameNode = splNameNewNode.partition("host")[2].strip()
if self.getXMLStaticHost(hostnameNode):
self.setError(_('DHCP static host "%s" exists')%hostnameNode)
@ -16627,10 +16624,10 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
if self.getError():
return False
namesArea = xpath.Evaluate("child::caption/child::name", xmlNode)
splNameNewNode = namesArea[0].firstChild.nodeValue
splNameNewNode = firstChild(namesArea[0]).nodeValue
netIPList = splNameNewNode.partition("subnet")[2].partition("netmask")
netIP = netIPList[0].strip().encode("UTF-8")
netMask = netIPList[2].partition("{")[0].strip().encode("UTF-8")
netIP = netIPList[0].strip()
netMask = netIPList[2].partition("{")[0].strip()
if not any((routers, domainName, dnsIPs, iprange)):
self.setError(_("empty modify options"))
return False
@ -16641,7 +16638,7 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
# Объединение конфигураций
self.join(dhcpObj)
# Запись файла
text = self.getConfig().encode("UTF-8")
text = self.getConfig()
return self.writeInConfig(text)
def modHostOpts(self, xmlNode, ip, mac):
@ -16649,8 +16646,8 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
if self.getError():
return False
namesArea = xpath.Evaluate("child::caption/child::name", xmlNode)
splNameNewNode = namesArea[0].firstChild.nodeValue
hostname = splNameNewNode.partition("host")[2].strip().encode("UTF-8")
splNameNewNode = firstChild(namesArea[0]).nodeValue
hostname = splNameNewNode.partition("host")[2].strip()
if not any((ip, mac)):
self.setError(_("empty modify options"))
return False
@ -16659,7 +16656,7 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
# Объединение конфигураций
self.join(dhcpObj)
# Запись файла
text = self.getConfig().encode("UTF-8")
text = self.getConfig()
return self.writeInConfig(text)
def createNet(self, net, routers, domainNames, dnsIPs, ipranges):
@ -16681,30 +16678,30 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
xmlNodeBodyNewNet = dhcpObj.docObj.getNodeBody()
namesAreaNew = xpath.Evaluate("child::area/child::caption/child::name",
xmlNodeBodyNewNet)
splNameNewNode = namesAreaNew[0].firstChild.nodeValue
splNameNewNode = firstChild(namesAreaNew[0]).nodeValue
netIP = splNameNewNode.partition("subnet")[2].partition("netmask")[0]
netIP = netIP.encode("UTF-8")
# netIP = netIP.encode("UTF-8")
if self.getXMLNet(netIP):
self.setError(_('DHCP subnet "%s" exists')%netIP)
return False
# Объединение конфигураций
self.join(dhcpObj)
# Запись файла
text = self.getConfig().encode("UTF-8")
text = self.getConfig()
return self.writeInConfig(text)
def deleteAllNetAndHosts(self):
"""Удаляет все сети и статические хосты из конфигурационного файла"""
# IP всех сетей
delNamesNets = [x.firstChild.nodeValue.partition("subnet")[2].\
partition("netmask")[0].encode("UTF-8")
delNamesNets = [firstChild(x).nodeValue.partition("subnet")[2].\
partition("netmask")[0]
for x in self.getAllXMLSubnet()
if x.firstChild]
if firstChild(x) is not None]
# Имена всех статических хостов
delNamesHosts = [x.firstChild.nodeValue.partition("host")[2].\
strip().encode("UTF-8")
delNamesHosts = [firstChild(x).nodeValue.partition("host")[2].\
strip()
for x in self._getAllXMLStaticHosts()
if x.firstChild]
if firstChild(x) is not None]
# Удаление
for term in (self.deleteNet(x) for x in delNamesNets):
if not term:
@ -16726,8 +16723,8 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
return False
# Удаление областей
xmlNodeBody = self.docObj.getNodeBody()
nextNode = lambda x: x.nextSibling
prevNode = lambda x: x.previousSibling
nextNode = lambda x: x.getnext()
prevNode = lambda x: x.getprevious()
delNodesNext = []
delNodesPrev = []
for node in deletesNodes:
@ -16757,10 +16754,10 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
delNodesNext.pop()
delNodes = delNodesPrev + delNodesNext
# Удаляем переводы строк
[xmlNodeBody.removeChild(x) for x in delNodes]
[xmlNodeBody.remove(x) for x in delNodes]
#print xmlNodeBody.toprettyxml().encode("UTF-8")
# Удаляем области
for term in (xmlNodeBody.removeChild(x) for x in deletesNodes):
for term in (xmlNodeBody.remove(x) for x in deletesNodes):
if not term:
self.setError(_('Can not remove static host "%s"')%hostname+\
" " + _("in config file %s")%self.nameConfigFile)
@ -16781,8 +16778,8 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
return False
# Удаление областей
xmlNodeBody = self.docObj.getNodeBody()
nextNode = lambda x: x.nextSibling
prevNode = lambda x: x.previousSibling
nextNode = lambda x: x.getnext()
prevNode = lambda x: x.getprevious()
delNodesNext = []
delNodesPrev = []
for node in deletesNodes:
@ -16812,16 +16809,16 @@ class dncpTxt(cl_profile.dhcp, shareTxt, shareIP):
delNodesNext.pop()
delNodes = delNodesPrev + delNodesNext
# Удаляем переводы строк
[xmlNodeBody.removeChild(x) for x in delNodes]
[xmlNodeBody.remove(x) for x in delNodes]
#print xmlNodeBody.toprettyxml().encode("UTF-8")
# Удаляем области
for term in (xmlNodeBody.removeChild(x) for x in deletesNodes):
for term in (xmlNodeBody.remove(x) for x in deletesNodes):
if not term:
self.setError(_('Can not remove subnet "%s"')%net+\
" " + _("in config file %s")%self.nameConfigFile)
return False
# Запись файла
text = self.getConfig().encode("UTF-8")
text = self.getConfig()
return self.writeInConfig(text)
class dnsTxt(cl_profile.bind,shareTxt):
@ -16883,8 +16880,8 @@ class dnsTxt(cl_profile.bind,shareTxt):
if not namesArea:
return []
return [x for x in namesArea
if x.firstChild and x.firstChild.nodeValue and\
'zone"' in x.firstChild.nodeValue]
if firstChild(x) is not None and firstChild(x).nodeValue and\
'zone"' in firstChild(x).nodeValue]
def getXMLZoneToName(self, nameZone):
"""Получить XML ноду DNS зоны по ее имени"""
@ -16897,10 +16894,10 @@ class dnsTxt(cl_profile.bind,shareTxt):
if not xmlZonesNames:
return []
nameZoneL = nameZone.lower()
return [x.parentNode.parentNode
return [x.getparent().getparent()
for x in xmlZonesNames
if nameZoneL == \
x.firstChild.nodeValue.lower().partition('"')[2].partition('"')[0]]
firstChild(x).nodeValue.lower().partition('"')[2].partition('"')[0]]
def getAllNamesZones(self):
"""Получить все имена нод областей (кроме служебных)"""
@ -16912,16 +16909,16 @@ class dnsTxt(cl_profile.bind,shareTxt):
if not xmlZonesNames:
return retNodesNames
for nodeZone in xmlZonesNames:
if '"."' in nodeZone.firstChild.nodeValue.lower():
if '"."' in firstChild(nodeZone).nodeValue.lower():
continue
elif '"localhost"' in nodeZone.firstChild.nodeValue.lower():
elif '"localhost"' in firstChild(nodeZone).nodeValue.lower():
continue
elif '"127.in-addr.arpa"' in nodeZone.firstChild.nodeValue.lower():
elif '"127.in-addr.arpa"' in firstChild(nodeZone).nodeValue.lower():
continue
retNodesNames.append(\
nodeZone.firstChild.nodeValue.rpartition('"')[0].partition('"')[2])
firstChild(nodeZone).nodeValue.rpartition('"')[0].partition('"')[2])
retNodesNames = [x for x in retNodesNames if x]
return [x.encode("UTF-8") for x in retNodesNames]
return retNodesNames
def deleteZone(self, zoneName):
"""Удаляет зону из конфигурационного файла bind"""
@ -16935,8 +16932,8 @@ class dnsTxt(cl_profile.bind,shareTxt):
return False
# Удаление областей
xmlNodeBody = self.docObj.getNodeBody()
nextNode = lambda x: x.nextSibling
prevNode = lambda x: x.previousSibling
nextNode = lambda x: x.getnext()
prevNode = lambda x: x.getprevious()
delNodesNext = []
delNodesPrev = []
for node in deletesNodes:
@ -16966,16 +16963,16 @@ class dnsTxt(cl_profile.bind,shareTxt):
delNodesNext.pop()
delNodes = delNodesPrev + delNodesNext
# Удаляем переводы строк
[xmlNodeBody.removeChild(x) for x in delNodes]
[xmlNodeBody.remove(x) for x in delNodes]
#print xmlNodeBody.toprettyxml().encode("UTF-8")
# Удаляем области
for term in [xmlNodeBody.removeChild(x) for x in deletesNodes]:
for term in [xmlNodeBody.remove(x) for x in deletesNodes]:
if not term:
self.setError(_('Can not remove DNS zone "%s"')%zoneName+\
" " + _("in config file %s")%self.nameConfigFile)
return False
# Запись файла
text = self.getConfig().encode("UTF-8")
text = self.getConfig()
return self.writeInConfig(text)
def deleteAllZones(self, functPrintSuccess=False):
@ -16995,7 +16992,7 @@ class dnsTxt(cl_profile.bind,shareTxt):
if not xmlZonesNames:
return True
for nodeZone in xmlZonesNames:
nodeValue = nodeZone.firstChild.nodeValue.lower()
nodeValue = firstChild(nodeZone).nodeValue.lower()
if '"."' in nodeValue:
continue
elif '"localhost"' in nodeValue:
@ -17003,14 +17000,14 @@ class dnsTxt(cl_profile.bind,shareTxt):
elif '"127.in-addr.arpa"' in nodeValue:
continue
else:
nodeValue = nodeValue.encode("UTF-8")
# nodeValue = nodeValue.encode("UTF-8")
# Название зоны
nameZ = nodeValue.rpartition('"')[0].partition('"')[2]
deletesNodes.append((nodeZone.parentNode.parentNode,nameZ))
deletesNodes.append((nodeZone.getparent().getparent(), nameZ))
# Удаление областей
xmlNodeBody = self.docObj.getNodeBody()
nextNode = lambda x: x.nextSibling
prevNode = lambda x: x.previousSibling
nextNode = lambda x: x.getnext()
prevNode = lambda x: x.getprevious()
delNodesNext = []
delNodesPrev = []
for node, zoneNameTmp in deletesNodes:
@ -17043,11 +17040,11 @@ class dnsTxt(cl_profile.bind,shareTxt):
if not delNode in delNodes:
delNodes.append(delNode)
# Удаляем переводы строк
[xmlNodeBody.removeChild(x) for x in delNodes]
[xmlNodeBody.remove(x) for x in delNodes]
#print xmlNodeBody.toprettyxml().encode("UTF-8")
# Удаляем области
for delNode, zoneName in deletesNodes:
if xmlNodeBody.removeChild(delNode):
if xmlNodeBody.remove(delNode):
# Печатаем сообщение о успешном удалении зоны
if flagPrintSuccess:
functPrintSuccess(zoneName)
@ -17056,7 +17053,7 @@ class dnsTxt(cl_profile.bind,shareTxt):
" " + _("in config file %s")%self.nameConfigFile)
return False
# Запись файла
text = self.getConfig().encode("UTF-8")
text = self.getConfig()
return self.writeInConfig(text)
def createZone(self, clVars, zoneName, zoneType, zoneMasters=[]):
@ -17072,7 +17069,7 @@ class dnsTxt(cl_profile.bind,shareTxt):
namesAreaNew = xpath.Evaluate(\
"child::area/child::caption/child::name", xmlNodeBodyNewZone)
splNameNewNode =\
namesAreaNew[0].firstChild.nodeValue.replace("{","").split('"')
firstChild(namesAreaNew[0]).nodeValue.replace("{","").split('"')
splNameNewNode = splNameNewNode[1]
if self.getXMLZoneToName(splNameNewNode):
self.setError(_('DNS zone "%s" exists')%splNameNewNode)
@ -17080,7 +17077,7 @@ class dnsTxt(cl_profile.bind,shareTxt):
# Объединение конфигураций
self.join(bindObj)
# Запись файла
text = self.getConfig().encode("UTF-8")
text = self.getConfig()
return self.writeInConfig(text)
def notFoundZones(self, zoneNames):
@ -20211,7 +20208,7 @@ class servDhcp(shareLdap, shareIP):
self.printERROR("Can not found network %s in network interfaces: \
eth0, eth1, ... etc."%net)
if osNets:
self.printWARNING(_("Existing nets: %s")%osNets)
self.printWARNING(_("Existing nets: %s") % osNets)
return False
def isCorrectMacAddress(self, mac):

File diff suppressed because it is too large Load Diff

@ -253,24 +253,24 @@ class Data:
ld_samba_hash = {}
# Директория настроек пользователя windows
sr_samba_winprof_path = {\
'value':'/var/calculate/server-data/samba/profiles/win'}
sr_samba_winprof_path = \
{'value':'/var/calculate/server-data/samba/profiles/win'}
# Директория хранения настроек пользователя linux
sr_samba_linprof_path = {\
'value':'/var/calculate/server-data/samba/profiles/unix'}
sr_samba_linprof_path = \
{'value':'/var/calculate/server-data/samba/profiles/unix'}
# Домашняя директория
sr_samba_home_path = {\
'value':'/var/calculate/server-data/samba/home'}
sr_samba_home_path = \
{'value':'/var/calculate/server-data/samba/home'}
# Директория netlogon
sr_samba_winlogon_path = {\
'value':'/var/calculate/server-data/samba/netlogon'}
sr_samba_winlogon_path = \
{'value':'/var/calculate/server-data/samba/netlogon'}
# Директория share
sr_samba_share_path = {\
'value':'/var/calculate/server-data/samba/share'}
sr_samba_share_path = \
{'value':'/var/calculate/server-data/samba/share'}
# Настроен или нет сервис Samba
sr_samba_set = {'mode':"w",

File diff suppressed because it is too large Load Diff

@ -24,8 +24,10 @@ from distutils.core import setup
from distutils.command.build_scripts import build_scripts
from distutils.command.install_scripts import install_scripts
from distutils.command.install_data import install_data
def cmp(a, b):
return (a > b) - (b < a)
data_files = []
var_data_files = [("/var/calculate/server-profile",[]),
@ -104,8 +106,8 @@ def create_data_files (data_dirs, prefix=""):
test1_files = test2_files + test1_files
return test1_files
data_files += create_data_files (data_dirs_local)
data_files += create_data_files (data_dirs_share, share_calculate_dir)
data_files += create_data_files(data_dirs_local)
data_files += create_data_files(data_dirs_share, share_calculate_dir)
data_files += [('/etc/conf.d', ['data/sortmilter.conf']),
('/etc/init.d', ['data/sortmilter.init'])]
@ -145,13 +147,6 @@ class cl_install_data(install_data):
("/etc/conf.d/sortmilter.conf","sortmilter",None)]
data_find = \
dict(
# map(lambda x:(os.path.basename(x[0]),
# [list(reversed(filter(lambda y:y,x[0].split("/")))),
# x[1],
# x[2]]),
# data_file))
# [(os.path.basename(x[0]), [list(reversed(filter(lambda y:y,x[0].split("/")))), x[1],x[2]]) for x in data_file])
[(os.path.basename(x[0]), [list(reversed((y for y in x[0].split("/") if y))), x[1],x[2]]) for x in data_file])
for path in self.get_outputs():

Loading…
Cancel
Save