Merge branch 'master' of git.calculate.ru:calculate-client

master3.3
Mike Hiretsky 14 years ago
commit d749e4bcd4

@ -37,6 +37,7 @@ from cl_ldap import ldapUser
from client.progressbar import ProgressBar from client.progressbar import ProgressBar
from cl_utils import runOsCommand, getpathenv, getModeFile, removeDir, isMount from cl_utils import runOsCommand, getpathenv, getModeFile, removeDir, isMount
from _cl_keys import getKey, clearKey from _cl_keys import getKey, clearKey
from convertenv import convertEnv
lang().setLanguage(sys.modules[__name__]) lang().setLanguage(sys.modules[__name__])
@ -206,7 +207,7 @@ class ldapData(ldapUser):
return resSearch return resSearch
return False return False
def getNameRemoteServer(self,userName, osLinuxShort): def getNameRemoteServer(self,userName, osLinuxShort, curHost):
"""Если профиль на удаленном сервере, то выдать DNS имя этого сервера """Если профиль на удаленном сервере, то выдать DNS имя этого сервера
""" """
searchPrevHost = self.searchPrevHost(userName, osLinuxShort) searchPrevHost = self.searchPrevHost(userName, osLinuxShort)
@ -216,7 +217,7 @@ class ldapData(ldapUser):
prevHost = None prevHost = None
# если местоположение актуального профиля найти не удалось # если местоположение актуального профиля найти не удалось
# или его местоположение не на локальном сервере # или его местоположение не на локальном сервере
if not prevHost or prevHost == osLinuxShort: if not prevHost or prevHost == curHost:
return False return False
else: else:
return prevHost return prevHost
@ -263,6 +264,9 @@ class client(share):
# словарь опций сервисов из /var/calculate/remote/server.env # словарь опций сервисов из /var/calculate/remote/server.env
optionsInfo = {} optionsInfo = {}
# объект конвертирования из старого remote env файла
convObj = None
def removeVars(self): def removeVars(self):
"""Удаление переменных шаблонов """Удаление переменных шаблонов
@ -510,7 +514,7 @@ class client(share):
# Создаем директорию для конфигурационных файлов # Создаем директорию для конфигурационных файлов
if not os.path.exists(pathConfig): if not os.path.exists(pathConfig):
self.createUserDir(uid, gid, pathConfig, mode=False) self.createUserDir(uid, gid, pathConfig, mode=False)
configFileName = os.path.join(pathConfig, self.configFileDesktop) configFileName = os.path.join(homeTemplate, self.configFileDesktop)
if sync == "login": if sync == "login":
# получить переменную files из секции Rsync файла # получить переменную files из секции Rsync файла
# .calculate.ini # .calculate.ini
@ -842,7 +846,8 @@ class client(share):
if replOn: if replOn:
osLinuxShort = self.clVars.Get("os_linux_shortname") osLinuxShort = self.clVars.Get("os_linux_shortname")
remoteServer = self.ldapDataObj.getNameRemoteServer(userName, remoteServer = self.ldapDataObj.getNameRemoteServer(userName,
osLinuxShort) osLinuxShort,
domain)
# Получаем монтируемые директории # Получаем монтируемые директории
names, dictRes = self.getUserMountResources(userName, homeDir, names, dictRes = self.getUserMountResources(userName, homeDir,
remoteServer) remoteServer)
@ -1277,7 +1282,7 @@ class client(share):
userLdapInfo = self.ldapDataObj.getUserLdapInfo(userName) userLdapInfo = self.ldapDataObj.getUserLdapInfo(userName)
if userLdapInfo: if userLdapInfo:
uid = int(userLdapInfo['uid']) uid = int(userLdapInfo['uid'])
gid = int(userLdapInfo['uid']) gid = int(userLdapInfo['gid'])
homeDir = userLdapInfo['home'] homeDir = userLdapInfo['home']
else: else:
self.printERROR(_("Can not found user %s in LDAP")%userName) self.printERROR(_("Can not found user %s in LDAP")%userName)
@ -1541,6 +1546,16 @@ class client(share):
def getInfoService(self, service, option, envFile=False): def getInfoService(self, service, option, envFile=False):
"""Получить параметр сервиса из env""" """Получить параметр сервиса из env"""
if not envFile:
if self.convObj == None:
# файл /var/calculate/remote/server.env
envFile = self.clVars.Get("cl_env_server_path")
if os.access(envFile, os.R_OK):
self.convObj = False
elif os.access("/var/calculate/remote/calculate.env", os.R_OK):
self.convObj = convertEnv()
if self.convObj:
return self.convObj.getVar(service, option)
if not self.optionsInfo: if not self.optionsInfo:
if not envFile: if not envFile:
# файл /var/calculate/remote/server.env # файл /var/calculate/remote/server.env

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from cl_client import client, __app__, __version__ from cl_client import client, __app__, __version__
from cl_opt import opt, TitledHelpFormatter from cl_opt import opt
import sys import sys
from cl_share_cmd import share_cmd from cl_share_cmd import share_cmd
@ -52,7 +52,6 @@ class client_cmd(share_cmd):
comment_examples=COMMENT_EXAMPLES, comment_examples=COMMENT_EXAMPLES,
description=DESCRIPTION, description=DESCRIPTION,
option_list=CMD_OPTIONS + opt.variable_control+opt.color_control, option_list=CMD_OPTIONS + opt.variable_control+opt.color_control,
formatter=TitledHelpFormatter(),
check_values=self.checkOpts) check_values=self.checkOpts)
# Создаем объект логики # Создаем объект логики
self.logicObj = client() self.logicObj = client()

@ -15,7 +15,7 @@
# limitations under the License. # limitations under the License.
from cl_client import client, __app__, __version__ from cl_client import client, __app__, __version__
from cl_opt import opt, TitledHelpFormatter from cl_opt import opt
import sys import sys
from cl_share_cmd import share_cmd from cl_share_cmd import share_cmd
@ -38,7 +38,6 @@ class install_cmd(share_cmd):
usage=USAGE, usage=USAGE,
description=DESCRIPTION, description=DESCRIPTION,
option_list=opt.variable_control+opt.color_control, option_list=opt.variable_control+opt.color_control,
formatter=TitledHelpFormatter(),
check_values=self.checkOpts) check_values=self.checkOpts)
# Создаем объект логики # Создаем объект логики
self.logicObj = client() self.logicObj = client()

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from cl_client import client, __app__, __version__ from cl_client import client, __app__, __version__
from cl_opt import opt, TitledHelpFormatter from cl_opt import opt
import sys import sys
from cl_share_cmd import share_cmd from cl_share_cmd import share_cmd
@ -47,7 +47,7 @@ resource")},
'help':_("not synchronize the user preferences, is used \ 'help':_("not synchronize the user preferences, is used \
in conjunction with the 'login' or 'logout'")}] in conjunction with the 'login' or 'logout'")}]
class sync(share_cmd): class sync_cmd(share_cmd):
def __init__(self): def __init__(self):
# Объект опций командной строки # Объект опций командной строки
self.optobj = opt(\ self.optobj = opt(\
@ -58,7 +58,6 @@ class sync(share_cmd):
comment_examples=COMMENT_EXAMPLES, comment_examples=COMMENT_EXAMPLES,
description=DESCRIPTION, description=DESCRIPTION,
option_list=CMD_OPTIONS + opt.variable_control+opt.color_control, option_list=CMD_OPTIONS + opt.variable_control+opt.color_control,
formatter=TitledHelpFormatter(),
check_values=self.checkOpts) check_values=self.checkOpts)
# Создаем объект логики # Создаем объект логики
self.logicObj = client() self.logicObj = client()

@ -15,7 +15,7 @@
# limitations under the License. # limitations under the License.
from cl_client import client, __app__, __version__ from cl_client import client, __app__, __version__
from cl_opt import opt, TitledHelpFormatter from cl_opt import opt
import sys import sys
from cl_share_cmd import share_cmd from cl_share_cmd import share_cmd
@ -38,7 +38,6 @@ class uninstall_cmd(share_cmd):
usage=USAGE, usage=USAGE,
description=DESCRIPTION, description=DESCRIPTION,
option_list=opt.variable_control+opt.color_control, option_list=opt.variable_control+opt.color_control,
formatter=TitledHelpFormatter(),
check_values=self.checkOpts) check_values=self.checkOpts)
# Создаем объект логики # Создаем объект логики
self.logicObj = client() self.logicObj = client()

@ -21,7 +21,7 @@ sys.path.insert(0,os.path.abspath('/usr/lib/calculate-2.2/calculate-lib/pym'))
sys.path.insert(0,\ sys.path.insert(0,\
os.path.abspath('/usr/lib/calculate-2.2/calculate-client/pym')) os.path.abspath('/usr/lib/calculate-2.2/calculate-client/pym'))
from cl_sync import sync from cl_sync_cmd import sync_cmd
from cl_lang import lang from cl_lang import lang
tr = lang() tr = lang()
@ -29,7 +29,7 @@ tr.setGlobalDomain('cl_desktop')
tr.setLanguage(sys.modules[__name__]) tr.setLanguage(sys.modules[__name__])
if __name__ == "__main__": if __name__ == "__main__":
obj = sync() obj = sync_cmd()
ret = obj.optobj.parse_args() ret = obj.optobj.parse_args()
if ret is False: if ret is False:
sys.exit(1) sys.exit(1)

@ -141,8 +141,8 @@ setup(
package_dir = {'calculate-client': "."}, package_dir = {'calculate-client': "."},
packages = ['calculate-client.pym'], packages = ['calculate-client.pym'],
data_files = data_files, data_files = data_files,
scripts=["./scripts/cl-sync-2.2", scripts=["./scripts/cl-sync",
"./scripts/cl-client-2.2", "./scripts/cl-client",
"./scripts/install", "./scripts/install",
"./scripts/uninstall"], "./scripts/uninstall"],
ext_modules = [Extension('calculate-client.pym._cl_keys', ext_modules = [Extension('calculate-client.pym._cl_keys',

Loading…
Cancel
Save