develop
mhiretskiy 16 years ago
parent 7346011448
commit d37ba7a2ad

@ -173,7 +173,7 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
if "ok" in textLine:
return True
else:
self.printNotOK(_("LDAP start")+ " ...")
self.printNotOK(_("Starting LDAP")+ " ...")
return False
def restartLdapServer(self):
@ -182,7 +182,7 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
if "ok" in textLine:
return True
else:
self.printNotOK(_("LDAP restart")+ " ...")
self.printNotOK(_("Restarting LDAP")+ " ...")
return False
def stopLdapServer(self):
@ -192,7 +192,7 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
#self.printOK(_("LDAP stop")+ " ...")
return True
else:
self.printNotOK(_("LDAP stop")+ " ...")
self.printNotOK(_("Stopping LDAP")+ " ...")
return False
def getALLServices(self):
@ -231,7 +231,7 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
def stopServices(self, servInstalled):
"""Останавливает все сервисы поданные на вход этому методу
Входные даннные - список
Входные даннные - список названий сервисов
"""
flagError = False
flagLdap = False
@ -243,15 +243,15 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
if self.getRunDaemons(["postfix"]):
textLine = self.execProg("/etc/init.d/postfix stop")
if not ("ok" in textLine):
self.printERROR( _("Service %s is not stopped")%\
str("Postfix"))
self.printERROR( "Postfix" + " " +
_("service is not stopped"))
flagError = True
break
if self.getRunDaemons(["dovecot"]):
textLine = self.execProg("/etc/init.d/dovecot stop")
if not ("ok" in textLine):
self.printERROR( _("Service %s is not stopped")%\
str("Dovecot"))
self.printERROR(str("Dovecot") + " " +
_("service is not stopped"))
flagError = True
break
continue
@ -259,16 +259,16 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
stopService = service
textLine = self.execProg("/etc/init.d/%s stop" %(stopService))
if not ("ok" in textLine):
self.printERROR( _("Service %s is not stopped")%\
str(service))
self.printERROR( str(service) + " " +
_("service is not stopped"))
flagError = True
break
if flagLdap:
if self.getRunService('ldap'):
textLine = self.execProg("/etc/init.d/slapd stop")
if not ("ok" in textLine):
print "END ERROR"
self.printERROR(_("Service LDAP is not stopped"))
self.printERROR( "LDAP" + " " +
_("service is not stopped"))
flagError = True
if flagError:
return False
@ -355,9 +355,8 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
flagError = True
if flagError:
if printError:
self.printNotOK(_("Service") + " " +\
nameService.capitalize() + " " +\
_("started")+ " ...")
self.printERROR( nameService.capitalize + " " +
_("service is not started") + " ...")
return False
return True
@ -451,7 +450,7 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
ldap.SCOPE_SUBTREE,
'(objectclass=*)',None)
except ldap.LDAPError, e:
self.printERROR(_("fullElementDN") +": "+e[0]['desc'])
self.printERROR("fullElementDN: "+e[0]['desc'])
return False
outText = ""
lenDNlist = len(dnList)
@ -488,7 +487,7 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
'(objectclass=*)',
[''])
except ldap.LDAPError, e:
self.printERROR(_("deleteDN") +": "+e[0]['desc'])
self.printERROR("deleteDN: "+e[0]['desc'])
return False
for dn, f in dnList:
delListDN.append(dn)
@ -497,7 +496,7 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
try:
self.conLdap.delete_s(dn)
except ldap.LDAPError, e:
self.printERROR(_("deleteDN") +": "+e[0]['desc'])
self.printERROR("deleteDN: "+e[0]['desc'])
return False
return True
@ -1088,7 +1087,7 @@ class servUnix(shareLdap):
self.printERROR(_("UID is not number") + " ...")
return False
if self.searchUidUnix(userId):
self.printERROR("UID %s "%userId + " " + \
self.printERROR("UID %s "%userId + \
_("exists in Unix service") + " ...")
return False
if self.searchUidPasswd(userId):
@ -1125,7 +1124,7 @@ class servUnix(shareLdap):
else:
if self.searchGroupGroupName(userName):
self.printERROR(
_("Group name %s is found")%str(userName) +\
_("Group name %s is found in")%str(userName) +\
" /etc/group ...")
return False
if self.searchUnixGroupName(userName):
@ -1154,7 +1153,7 @@ class servUnix(shareLdap):
resGroup = self.searchGroupGroupName(groupName)
if not (resLdap or resGroup):
self.printERROR (_("ERROR") + ": " +\
"gid=" + userGid + _("is not found"))
"gid=" + userGid + " " + _("is not found"))
return False
if resGroup:
userGid = resGroup.split(":")[2]
@ -1189,7 +1188,7 @@ class servUnix(shareLdap):
self.printERROR (_("ERROR") + ": " +\
_("cannot create HOME dir"))
return False
self.printSUCCESS(_("Created home dir")+ " " + homeDir+\
self.printSUCCESS(_("Created home dir %s")% homeDir+\
" ...")
self.printSUCCESS(_("Added user in Unix service") + " ...")
return True
@ -1570,10 +1569,10 @@ class servUnix(shareLdap):
self.printSUCCESS(_("Modified user password of Unix service")+\
" ...")
if options.has_key('U'):
self.printSUCCESS(_("Unlocked user") + " " + str(userName) +\
self.printSUCCESS(_("Unlocked user %s")% str(userName) +\
" ...")
if options.has_key('L'):
self.printSUCCESS(_("Locked user") + " " + str(userName) +\
self.printSUCCESS(_("Locked user %s")% str(userName) +\
" ...")
return True
@ -1764,24 +1763,27 @@ class servUnix(shareLdap):
if self.clVars.Get("soft_unix_setup") == "yes" and\
not forceOptions:
self.printWARNING (_("WARNING") + ": " +\
_("Unix service is configured")+ ".")
_("Unix service already configured")+ ".")
return True
if not self.clVars.Get("soft_ldap_setup") == "yes":
self.printERROR(_("LDAP service not setup ..."))
self.printERROR(_("LDAP service not setuped") +" ...")
return False
if not forceOptions:
# предупреждение при выполнении этой программы будут изменены
# конфигурационные файлы и база данных сервиса LDAP
self.printWARNING (_("WARNING") + ": " +\
_("When you execute this program the configuration files and data \
service LDAP will be changed")+ ".")
self.printWARNING (_("WARNING") + ": " +
_("Executing of the program will change") + " " +
_("the configuration files and database of LDAP service")+
".")
# если вы ранее использовали программу cl-setup то в дальнейшем
# можете использовать cl-backup для резервного копирования
self.printWARNING (_("If previously used the program cl-setup") +\
", " + _("you can run cl-backup for backup services"))
self.printWARNING (
_("If cl-setup program was used previously") + "," +
_("you may execute cl-backup program for backup services"))
# если вы готовы продолжить работу программы нажмите Y если нет n
messDialog = _("If you are ready to continue the program, press Y,\
if not n")
messDialog =
_("If you are ready to continue executing the program") + "," +
_("press Y") +","+ _("if not n")
if not self.dialogYesNo(messDialog):
return True
# Проверим запущен ли ldap
@ -1807,10 +1809,10 @@ service LDAP will be changed")+ ".")
delDN = self.relDN
ret = self.deleteDN(delDN)
if ret:
self.printOK(_("Removed Unix DN from LDAP Database") + " ...")
self.printOK(_("Removed Unix DN from LDAP database") + " ...")
else:
self.printERROR(\
_("Can not remove Unix DN from LDAP Database") + " ...")
_("Can not remove Unix DN from LDAP database") + " ...")
if not ret:
return False
ldifFile = self.ldifFileBase
@ -1929,9 +1931,9 @@ class servMail(shareLdap):
mailDir = os.path.join(self.mailLocation,userName)
if self.servUnixObj.removeHomeDir(mailDir):
self.printSUCCESS(\
_("Mail service directory %s is removed")% str(mailDir) +\
_("Mail user directory %s is removed")% str(mailDir) +\
" ...")
self.printSUCCESS(_("Service Mail user %s is deleted")%userName +\
self.printSUCCESS(_("Mail user %s is deleted")%userName +\
" ...")
return True
@ -2029,7 +2031,7 @@ class servMail(shareLdap):
delDN = self.addDN("cn="+groupName, self.relGroupsDN)
res = self.delDN(delDN)
if res:
self.printSUCCESS( _("Mail group: %s is deleted")%groupName +\
self.printSUCCESS( _("Mail group %s is deleted")%groupName +\
" ...")
return True
else:
@ -2244,11 +2246,11 @@ class servMail(shareLdap):
if options.has_key('c'):
self.printSUCCESS(_("Modified comment") + " ...")
if options.has_key('L'):
self.printSUCCESS(_("Locked Mail user") + " " +\
str(userName) + " ...")
self.printSUCCESS(_("Locked Mail user %s")%str(userName) +
" ...")
if options.has_key('U'):
self.printSUCCESS(_("Unlocked Mail user") + " " +\
str(userName) + " ...")
self.printSUCCESS(_("Unlocked Mail user %s")%str(userName) +
" ...")
if options.has_key('e'):
self.printSUCCESS(_("Modified Mail alternate addresses") +\
"...")
@ -2351,11 +2353,11 @@ class servMail(shareLdap):
if not self.modAttrsDN(DN, modAttrs):
return False
if options.has_key('l'):
self.printSUCCESS(_("Locked Mail user") + " " + str(userName)+\
" ...")
self.printSUCCESS(_("Locked Mail user %s")% str(userName)+\
" ...")
if options.has_key('u'):
self.printSUCCESS(_("Unlocked Mail user") + " " +\
str(userName) + " ...")
self.printSUCCESS(_("Unlocked Mail user %s")% str(userName)+
" ...")
if not options:
self.printSUCCESS(_("Changed Mail user password") + " ...")
return True
@ -2588,16 +2590,19 @@ class servMail(shareLdap):
if not forceOptions:
# предупреждение при выполнении этой программы будут изменены
# конфигурационные файлы сервиса Mail (программы Postfix и Dovecot)
self.printWARNING (_("WARNING") + ": " +\
_("When you execute this program the configuration files \
service Mail will be changed (programm Postfix and Dovecot)")+ ".")
self.printWARNING (_("WARNING") + ": " +
_("Executing of the program will change") + " " +
_("the configuration files of Mail service") +"("+
_("programs Postfix and Dovecot") + ")." )
# если вы ранее использовали программу cl-setup то в дальнейшем
# можете использовать cl-backup для резервного копирования
self.printWARNING (_("If previously used the program cl-setup") +\
", " + _("you can run cl-backup for backup services"))
self.printWARNING (
_("If cl-setup program was used previously") + "," +
_("you may execute cl-backup program for backup services"))
# если вы готовы продолжить работу программы нажмите Y если нет n
messDialog = _("If you are ready to continue the program, press Y,\
if not n")
messDialog =
_("If you are ready to continue executing the program") + "," +
_("press Y") +","+ _("if not n")
if not self.dialogYesNo(messDialog):
return True
# останавливаем сервис Mail
@ -2651,15 +2656,15 @@ service Mail will be changed (programm Postfix and Dovecot)")+ ".")
return False
textLine = self.execProg("/etc/init.d/postfix start")
if "ok" in textLine:
self.printOK("Postfix" + " " + _("start")+ " ...")
self.printOK(_("Starting") + " " + "Postfix" + " ...")
else:
self.printNotOK("Postfix" + " " + _("start")+ " ...")
self.printNotOK(_("Starting") + " " + "Postfix" + " ...")
return False
textLine = self.execProg("/etc/init.d/dovecot start")
if "ok" in textLine:
self.printOK("Dovecot" + " " + _("start")+ " ...")
self.printOK(_("Starting") + " " + "Dovecot" + " ...")
else:
self.printNotOK("Dovecot" + " " + _("start")+ " ...")
self.printNotOK(_("Starting") + " " + "Dovecot" + " ...")
return False
self.clVars.Write("soft_mail_setup","yes")
self.printOK(_("Mail service configured") + " ...")
@ -2732,8 +2737,8 @@ class servSamba(shareLdap):
_("Can not delete Samba user") + " " + str(delUser) + " ...")
return False
else:
self.printSUCCESS(_("Deleted Samba user") + " " +\
str(delUser) + " ...")
self.printSUCCESS(_("Deleted Samba user %s") % str(delUser) +
" ...")
return True
@adminConnectLdap
@ -2855,16 +2860,18 @@ class servSamba(shareLdap):
if not forceOptions:
# предупреждение при выполнении этой программы будут изменены
# конфигурационные файлы сервиса Samba
self.printWARNING (_("WARNING") + ": " +\
_("When you execute this program the configuration files \
service Samba will be changed")+ ".")
self.printWARNING (_("WARNING") + ": " +
_("Executing of the program will change") + " " +
_("the configuration files of Samba service") + ".")
# если вы ранее использовали программу cl-setup то в дальнейшем
# можете использовать cl-backup для резервного копирования
self.printWARNING (_("If previously used the program cl-setup") +\
", " + _("you can run cl-backup for backup services"))
self.printWARNING (
_("If cl-setup program was used previously") + "," +
_("you may execute cl-backup program for backup services"))
# если вы готовы продолжить работу программы нажмите Y если нет n
messDialog = _("If you are ready to continue the program, press Y,\
if not n")
messDialog =
_("If you are ready to continue executing the program") + "," +
_("press Y") +","+ _("if not n")
if not self.dialogYesNo(messDialog):
return True
# останавливаем сервис Samba
@ -2933,9 +2940,9 @@ service Samba will be changed")+ ".")
self.printOK(_("Added ldif file") +" ...")
textLine = self.execProg("/etc/init.d/samba start")
if "ok" in textLine:
self.printOK(_("Samba start") +" ...")
self.printOK(_("Starting") + " Samba ...")
else:
self.printNotOK(_("Samba start") +" ...")
self.printNotOK(_("Starting") + " Samba ...")
return False
print _("Enter the ROOT password")
if not self.addUserSambaServer('root',{'p':""}):
@ -2953,8 +2960,8 @@ service Samba will be changed")+ ".")
if options.has_key('l'):
textLine = self.execProg("smbpasswd -d %s" %(userName))
if "Disabled user %s" %userName in textLine:
self.printSUCCESS(_("Disabled Samba user")+ " " +\
str(userName) + " ...")
self.printSUCCESS(_("Disabled Samba user %s")%str(userName)+
" ...")
else:
self.printERROR(_("Can not disable Samba user")+ " "+\
str(userName) + " ...")
@ -2963,8 +2970,8 @@ service Samba will be changed")+ ".")
if options.has_key('u'):
textLine = self.execProg("smbpasswd -e %s" %(userName))
if "Enabled user %s" %userName in textLine:
self.printSUCCESS(_("Enabled Samba user")+ " " +\
str(userName) + " ...")
self.printSUCCESS(_("Enabled Samba user %s")%str(userName) +
" ...")
else:
self.printERROR(_("Can not enable Samba user")+ " "+\
str(userName) + " ...")
@ -3002,8 +3009,8 @@ service Samba will be changed")+ ".")
if options.has_key('L'):
textLine = self.execProg("smbpasswd -d %s" %(userName))
if "Disabled user %s" %userName in textLine:
self.printSUCCESS(_("Disabled Samba user")+ " " +\
str(userName) + " ...")
self.printSUCCESS(_("Disabled Samba user %s")%str(userName) +
" ...")
else:
self.printERROR(_("Can not disable Samba user")+ " "+\
str(userName) + " ...")
@ -3012,11 +3019,11 @@ service Samba will be changed")+ ".")
elif options.has_key('U'):
textLine = self.execProg("smbpasswd -e %s" %(userName))
if "Enabled user %s" %userName in textLine:
self.printSUCCESS(_("Enabled Samba user")+ " " +\
str(userName) + " ...")
self.printSUCCESS(_("Enabled Samba user %s")%str(userName) +
" ...")
else:
self.printERROR(_("Can not enable Samba user")+ " "+\
str(userName) + " ...")
str(userName) + " ...")
return False
# модифицируем пароль
if options.has_key('P') or options.has_key('p'):
@ -3199,16 +3206,16 @@ class servLdap(shareLdap):
if not self.getRunDaemons([daemon]):
textLine = self.execProg("/etc/init.d/%s start" %(daemon))
if not ("ok" in textLine):
self.printERROR( _("Daemon %s is not started") %daemon)
self.printERROR( _("Daemon %s was not started") %daemon)
flagError = True
break
if flagError:
self.printNotOK(_("Service") + " " + service.capitalize() + " " +\
_("started")+ " ...")
self.printNotOK(_("Starting") + " " + service.capitalize() + " " +\
_("service"))
return False
else:
self.printOK(_("Service") + " " + service.capitalize() + " " +\
_("started")+ " ...")
self.printOK(_("Starting") + " " + service.capitalize() + " " +\
_("service"))
return True
@ -3275,7 +3282,7 @@ class servLdap(shareLdap):
self.createClVars()
# Накладываем профили (берем из папки backup)
if not self.applyProfilesFromService(self.backupDir):
self.printERROR(_("Can not apply profile: backup"))
self.printERROR(_("Can not apply profile")+ ": backup")
return False
# Запускаем LDAP сервер
if not self.runLdapServer():
@ -3396,16 +3403,19 @@ class servLdap(shareLdap):
# предупреждение при выполнении этой программы будут изменены
# конфигурационные файлы и база данных сервиса LDAP а также
# конфигурационные файлы установленных сервисов
self.printWARNING (_("WARNING") + ": " +\
_("When you execute this program the configuration files and data \
service LDAP will be changed")+ ".")
self.printWARNING (_("WARNING") + ": " +
_("Executing of the program will change") + " " +
_("the configuration files and database of LDAP service")+
".")
# если вы ранее использовали программу cl-setup то в дальнейшем
# можете использовать cl-backup для резервного копирования
self.printWARNING (_("If previously used the program cl-setup") +\
", " + _("you can run cl-backup for backup services"))
self.printWARNING (
_("If cl-setup program was used previously") + "," +
_("you may execute cl-backup program for backup services"))
# если вы готовы продолжить работу программы нажмите Y если нет n
messDialog = _("If you are ready to continue the program, press Y,\
if not n")
messDialog =
_("If you are ready to continue executing the program") + "," +
_("press Y") +","+ _("if not n")
if not self.dialogYesNo(messDialog):
return True
# останавливаем сервисы
@ -4328,7 +4338,7 @@ class tsOpt(cl_base.opt):
def printErrorNotOpt(self):
"""Сообщение в случае отсутствия опций"""
print _("Not options.")
print _("Options are absent.")
def handlerOpt(self,option,value):
# Обработчик (опция значение)

Loading…
Cancel
Save