Added update env files

master3.3
Самоукин Алексей 14 years ago
parent 406f59a5e0
commit 72b90efc3f

@ -801,7 +801,7 @@ class client(share):
hostAuth = self.clVars.Get("os_remote_auth")
# В случае компьютера вне домена
if not hostAuth or not domain:
self.printSUCCESS(_("To be used local profile."))
self.printSUCCESS(_("To be used local profile"))
return True
# Проверим что компьютер в домене и смонтирован [remote]
connectDomain = self.isDomain()
@ -1267,7 +1267,7 @@ class client(share):
hostAuth = self.clVars.Get("os_remote_auth")
# В случае компьютера вне домена
if not hostAuth or not domain:
self.printSUCCESS(_("To be used local profile."))
self.printSUCCESS(_("To be used local profile"))
return True
connectDomain = self.isDomain()
if not connectDomain:
@ -1419,16 +1419,15 @@ class client(share):
def installClient(self):
"""Наложение шаблонов на систему при инсталяции"""
# Проверяем на root
if not self.isRoot():
return False
# Действие инсталяция
self.clVars.Set("cl_pass_action", "domain", True)
if not self.applyTemplatesFromSystem():
self.printERROR(_("Can not apply install templates"))
return False
self.printOK(_("Added use of scripts this package for window \
manager") + " ...")
domain = self.clVars.Get("cl_remote_host")
if domain:
if not self.addDaemonAutostart("client"):
return False
if not self.mountRemote():
return False
self.printOK(_("To be used domain profile") + " ...")
else:
self.printOK(_("To be used local profile") + " ...")
return True
def getDefaultRunlevelDaemons(self):
@ -1546,11 +1545,12 @@ manager") + " ...")
return False
return True
def getInfoService(self, service, option):
def getInfoService(self, service, option, envFile=False):
"""Получить параметр сервиса из env"""
if not self.optionsInfo:
# файл /var/calculate/remote/server.env
envFile = self.clVars.Get("cl_env_server_path")
if not envFile:
# файл /var/calculate/remote/server.env
envFile = self.clVars.Get("cl_env_server_path")
optInfo = self.clVars.GetRemoteInfo(envFile)
if optInfo is False:
return False
@ -1818,3 +1818,31 @@ manager") + " ...")
return False
self.restartDBus()
return True
def updateEnvFiles(self):
"""Апдейт env файлов до версии 2.2"""
previousVersion = self.clVars.Get("os_remote_client")
flagUpdate = False
if not previousVersion:
# Апдейт
envFile="/var/calculate/calculate.env"
remoteHost = self.getInfoService("client", "cl_remote_host",
envFile=envFile)
remotePw = self.getInfoService("client", "cl_remote_pw",
envFile=envFile)
if remoteHost and remotePw:
self.clVars.Write("cl_remote_host", remoteHost, True, "local")
self.clVars.Write("cl_remote_pw", remotePw, True, "local")
envFile="/etc/calculate/calculate.env"
previousVersion = self.getInfoService("client", "os_remote_client",
envFile=envFile)
workHost = self.getInfoService("client", "os_remote_auth",
envFile=envFile)
if previousVersion and workHost:
self.clVars.Write("os_remote_client", previousVersion, True)
if workHost != "local":
self.clVars.Write("os_remote_auth", workHost, True)
self.printOK(_("Update env files") + " ...")
flagUpdate = True
return flagUpdate

@ -55,4 +55,8 @@ class install_cmd(share_cmd):
def installProg(self):
"""Наложение шаблонов на систему при инсталяции"""
return self.logicObj.installClient()
return self.logicObj.installClient()
def updateEnvFiles(self):
"""Апдейт env файлов до новой версии"""
return self.logicObj.updateEnvFiles()

@ -43,6 +43,10 @@ if __name__ == "__main__":
obj.printVars(opts)
# Если нет печати переменных выполняем логику программы
if not opts.vars:
# Апдейт env файлов
if obj.updateEnvFiles():
# Перечитывание переменные шаблонов из env файлов
self.logicObj.clVars.flClient()
# Наложение шаблонов на систему при инсталяции
if not obj.installProg():
sys.exit(1)

Loading…
Cancel
Save