develop
asamoukin 16 years ago
parent fdfec0762f
commit 4160cb6572

@ -254,7 +254,7 @@ class cl_client(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
bindPw = self.clVars.Get("ld_bind_pw")
if not (bindDn or bindPw):
if printError:
self.printERROR(_("not found LDAP bind DN or password") +\
self.printERROR(_("Not found LDAP bind DN or password") +\
" ...")
return False
ldapObj = cl_utils2.ldapFun(bindDn, bindPw, host)
@ -449,7 +449,7 @@ class cl_client(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
# uid и gid и mail из passwd
uidGid = self.getUserPasswdInfo(userName)
if not uidGid:
self.printERROR(_(" Not found user uid and gid"))
self.printERROR(_("Not found user uid and gid"))
return False
uid = int(uidGid[0])
gid = int(uidGid[1])
@ -460,14 +460,18 @@ class cl_client(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
self.clVars.Set('cl_root_path',homeDir,True)
homeExists = os.path.exists(homeDir)
if homeExists and set(os.listdir(homeDir))-set(["Home","Disks"]):
self.printWARNING(_("home dir %s exists")%homeDir)
alwProfilePath = self.getAlwaysProfilePath()
if not alwProfilePath:
return True
if homeExists:
self.printWARNING(_("Home dir %s exists")%homeDir)
if set(os.listdir(homeDir))-set(["Home","Disks"]):
# Получаем пути к профилям постоянного наложения
alwProfilePath = self.getAlwaysProfilePath()
if not alwProfilePath:
return True
# Записываем пути к профилям постоянного наложения
#в переменную
self.printSUCCESS(_("Apply always profiles") + " ...")
self.clVars.Set('cl_profile_path',alwProfilePath, True)
self.printSUCCESS(_("apply always profiles") + " ...")
self.clVars.Set('cl_profile_path',alwProfilePath, True)
if not os.path.exists(homeDir):
self.createUserDir(uid, gid, homeDir)
# Записываем переменную логин
@ -481,8 +485,8 @@ class cl_client(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
return False
self.chownR(homeDir, uid, gid, dirsAndFiles)
if not homeExists:
self.printSUCCESS(_("created home dir %s")%homeDir + " ...")
self.printSUCCESS(_("User Profile is configured") + " ...")
self.printSUCCESS(_("Created home dir %s")%homeDir + " ...")
self.printSUCCESS(_("User account is configured") + " ...")
return True
def isDomain(self):
@ -567,7 +571,8 @@ cl_remote_pw") + " ...")
pathHome = "/var/calculate/home"
foundMountRemote =self.isMount(pathRemote ,"cifs")
foundMountHome =self.isMount(pathHome ,"none",False)
if not self.clVars.Get("cl_remote_host"):
domain = self.clVars.Get("cl_remote_host")
if not domain:
self.printWARNING("The computer is not in domain")
return True
if foundMountRemote:
@ -587,7 +592,7 @@ cl_remote_pw") + " ...")
self.execProg("calculate -P install/6intranet")
self.clVars.Delete("cl_remote_host","local")
self.clVars.Delete("cl_remote_pw","local")
self.printOK(_("Deleted in domain") + " ...")
self.printOK(_("Computer removed from domain %s")%domain + " ...")
return True
def addDomain(self, domain):
@ -672,7 +677,7 @@ or ld_bind_dn or ld_bind_pw")
--set-ldap_root=%s --set-ldap_bind=%s --set-ldap_bindpw=%s -P \
install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
self.execProg(execStr)
self.printOK(_("Added in domain %s")%domain + " ...")
self.printOK(_("Computer added to domain %s")%domain + " ...")
return True
def umountUserRes(self, userName):
@ -826,7 +831,8 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
--exclude="*~" --exclude="/Home" --exclude="/Disks" \
-a -b --delete -x %s/ %s/'%(userHome,homeProfile)
else:
self.printERROR(_("Method syncUser: option sync incorrect"))
self.printERROR(_("Method syncUser: option sync=%s incorrect")\
%str(sync))
return False
if execStr:
textLine = self.execProg(execStr)

@ -62,7 +62,7 @@ class fillVars(object, cl_base.glob_attr):
if resolution:
self.Set('hr_x11_height',resolution[1])
return resolution[0]
def get_hr_x11_standart(self):
"""Получить ближайший стандартный размер изображения к текущему разрешению"""
#Стандартные разрешения
@ -86,17 +86,17 @@ class fillVars(object, cl_base.glob_attr):
listFr = list(set(formats))
listFormats = {}
for fr in listFr:
listFormats[fr] = []
listFormats[fr] = []
for w, h in res:
for fr in listFormats.keys():
if fr == float(w)/float(h):
listFormats[fr].append((w,h))
listFormats[fr].append((w,h))
break
format = float(width)/float(height)
deltaFr = {}
for fr in listFormats.keys():
deltaFr[abs(format - fr)] = fr
resolution = listFormats[deltaFr[min(deltaFr.keys())]]
resolution = listFormats[deltaFr[min(deltaFr.keys())]]
flagFound = False
stResol = []
stHeights = []
@ -113,8 +113,18 @@ class fillVars(object, cl_base.glob_attr):
if stHeight == h:
stWidths.append(w)
if stWidths:
stWidth = min(stWidths)
stWidth = min(stWidths)
if (not stWidth) or (not stHeight):
return "%sx%s"%(resolution[-1][0],resolution[-1][1])
else:
return "%sx%s"%(stWidth,stHeight)
return "%sx%s"%(stWidth,stHeight)
def get_hr_laptop_set(self):
"""Является ли компьютер ноутбуком"""
if os.path.exists('/sys/class/dmi/id/board_name'):
line=self._runos("%s cat /sys/class/dmi/id/board_name"\
%self.path_env)
if "Portable PC" in line:
return "on"
else:
return "off"

@ -107,6 +107,10 @@ class Data:
#ближайший стандартный размер изображения к текущему разрешению
hr_x11_standart = {}
#Является ли компьютер ноутбуком
hr_laptop_set = {}
# Calculate плюс версия калкулэйта для записи в заголовок файла
# объединяемого с профилем
#setup_name

Loading…
Cancel
Save