From 577b73a2ec34dc9bb1a4a31bc49f74a5eb2cfe4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Wed, 2 Jun 2010 17:03:34 +0400 Subject: [PATCH 1/8] Added support /var/calculate/remote/calculate.env --- pym/cl_client.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pym/cl_client.py b/pym/cl_client.py index d98cab5..8ab0582 100644 --- a/pym/cl_client.py +++ b/pym/cl_client.py @@ -37,6 +37,7 @@ from cl_ldap import ldapUser from client.progressbar import ProgressBar from cl_utils import runOsCommand, getpathenv, getModeFile, removeDir, isMount from _cl_keys import getKey, clearKey +from convertenv import convertEnv lang().setLanguage(sys.modules[__name__]) @@ -269,6 +270,9 @@ class client(share): # словарь опций сервисов из /var/calculate/remote/server.env optionsInfo = {} + # объект конвертирования из старого remote env файла + convObj = None + def removeVars(self): """Удаление переменных шаблонов @@ -1547,6 +1551,16 @@ class client(share): def getInfoService(self, service, option, envFile=False): """Получить параметр сервиса из 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 envFile: # файл /var/calculate/remote/server.env From 2ed46c55281a45bb0d872c72d1bc77823e70e82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Wed, 2 Jun 2010 17:52:50 +0400 Subject: [PATCH 2/8] Bugfix --- pym/cl_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/cl_client.py b/pym/cl_client.py index bcc84e5..26b34a2 100644 --- a/pym/cl_client.py +++ b/pym/cl_client.py @@ -217,7 +217,7 @@ class ldapData(ldapUser): prevHost = None # если местоположение актуального профиля найти не удалось # или его местоположение не на локальном сервере - if not prevHost or prevHost == osLinuxShort: + if not prevHost or prevHost == self.clVars.Get('cl_remote_host'): return False else: return prevHost From cf716720f1ff84a73201bd1d5a8fbb13074ae99e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Wed, 2 Jun 2010 17:56:50 +0400 Subject: [PATCH 3/8] Bugfix --- pym/cl_client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pym/cl_client.py b/pym/cl_client.py index 26b34a2..26b169b 100644 --- a/pym/cl_client.py +++ b/pym/cl_client.py @@ -207,7 +207,7 @@ class ldapData(ldapUser): return resSearch return False - def getNameRemoteServer(self,userName, osLinuxShort): + def getNameRemoteServer(self,userName, osLinuxShort, curHost): """Если профиль на удаленном сервере, то выдать DNS имя этого сервера """ searchPrevHost = self.searchPrevHost(userName, osLinuxShort) @@ -217,7 +217,7 @@ class ldapData(ldapUser): prevHost = None # если местоположение актуального профиля найти не удалось # или его местоположение не на локальном сервере - if not prevHost or prevHost == self.clVars.Get('cl_remote_host'): + if not prevHost or prevHost == curHost: return False else: return prevHost @@ -846,7 +846,8 @@ class client(share): if replOn: osLinuxShort = self.clVars.Get("os_linux_shortname") remoteServer = self.ldapDataObj.getNameRemoteServer(userName, - osLinuxShort) + osLinuxShort, + domain) # Получаем монтируемые директории names, dictRes = self.getUserMountResources(userName, homeDir, remoteServer) From ea9ab04491639aa989055a9855229f497ba76b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Wed, 2 Jun 2010 18:11:49 +0400 Subject: [PATCH 4/8] Bugfix --- pym/cl_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/cl_client.py b/pym/cl_client.py index 26b169b..85029c8 100644 --- a/pym/cl_client.py +++ b/pym/cl_client.py @@ -514,7 +514,7 @@ class client(share): # Создаем директорию для конфигурационных файлов if not os.path.exists(pathConfig): self.createUserDir(uid, gid, pathConfig, mode=False) - configFileName = os.path.join(pathConfig, self.configFileDesktop) + configFileName = os.path.join(homeTemplate, self.configFileDesktop) if sync == "login": # получить переменную files из секции Rsync файла # .calculate.ini From dd7ba05a9477a25e76272dd07b5ca76f19769975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Wed, 2 Jun 2010 18:29:01 +0400 Subject: [PATCH 5/8] Bugfix --- pym/cl_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/cl_client.py b/pym/cl_client.py index 85029c8..c8d4940 100644 --- a/pym/cl_client.py +++ b/pym/cl_client.py @@ -1282,7 +1282,7 @@ class client(share): userLdapInfo = self.ldapDataObj.getUserLdapInfo(userName) if userLdapInfo: uid = int(userLdapInfo['uid']) - gid = int(userLdapInfo['uid']) + gid = int(userLdapInfo['gid']) homeDir = userLdapInfo['home'] else: self.printERROR(_("Can not found user %s in LDAP")%userName) From e4734a1b54b028106f4767ed6bd7deed84b5dfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Thu, 3 Jun 2010 09:17:09 +0400 Subject: [PATCH 6/8] Remove TitledHelpFormatter --- pym/cl_client_cmd.py | 3 +-- pym/cl_install_cmd.py | 3 +-- pym/cl_uninstall_cmd.py | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pym/cl_client_cmd.py b/pym/cl_client_cmd.py index 7081515..0a3053a 100644 --- a/pym/cl_client_cmd.py +++ b/pym/cl_client_cmd.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from cl_client import client, __app__, __version__ -from cl_opt import opt, TitledHelpFormatter +from cl_opt import opt import sys from cl_share_cmd import share_cmd @@ -52,7 +52,6 @@ class client_cmd(share_cmd): comment_examples=COMMENT_EXAMPLES, description=DESCRIPTION, option_list=CMD_OPTIONS + opt.variable_control+opt.color_control, - formatter=TitledHelpFormatter(), check_values=self.checkOpts) # Создаем объект логики self.logicObj = client() diff --git a/pym/cl_install_cmd.py b/pym/cl_install_cmd.py index 16dd86b..174f63b 100644 --- a/pym/cl_install_cmd.py +++ b/pym/cl_install_cmd.py @@ -15,7 +15,7 @@ # limitations under the License. from cl_client import client, __app__, __version__ -from cl_opt import opt, TitledHelpFormatter +from cl_opt import opt import sys from cl_share_cmd import share_cmd @@ -38,7 +38,6 @@ class install_cmd(share_cmd): usage=USAGE, description=DESCRIPTION, option_list=opt.variable_control+opt.color_control, - formatter=TitledHelpFormatter(), check_values=self.checkOpts) # Создаем объект логики self.logicObj = client() diff --git a/pym/cl_uninstall_cmd.py b/pym/cl_uninstall_cmd.py index 078221b..decd311 100644 --- a/pym/cl_uninstall_cmd.py +++ b/pym/cl_uninstall_cmd.py @@ -15,7 +15,7 @@ # limitations under the License. from cl_client import client, __app__, __version__ -from cl_opt import opt, TitledHelpFormatter +from cl_opt import opt import sys from cl_share_cmd import share_cmd @@ -38,7 +38,6 @@ class uninstall_cmd(share_cmd): usage=USAGE, description=DESCRIPTION, option_list=opt.variable_control+opt.color_control, - formatter=TitledHelpFormatter(), check_values=self.checkOpts) # Создаем объект логики self.logicObj = client() From 370a9c48e88516931311b475ea2d3f25603da349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Thu, 3 Jun 2010 09:22:18 +0400 Subject: [PATCH 7/8] Bugfix --- pym/{cl_sync.py => cl_sync_cmd.py} | 5 ++--- scripts/cl-sync-2.2 | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) rename pym/{cl_sync.py => cl_sync_cmd.py} (98%) diff --git a/pym/cl_sync.py b/pym/cl_sync_cmd.py similarity index 98% rename from pym/cl_sync.py rename to pym/cl_sync_cmd.py index 2dca863..227707e 100644 --- a/pym/cl_sync.py +++ b/pym/cl_sync_cmd.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from cl_client import client, __app__, __version__ -from cl_opt import opt, TitledHelpFormatter +from cl_opt import opt import sys from cl_share_cmd import share_cmd @@ -47,7 +47,7 @@ resource")}, 'help':_("not synchronize the user preferences, is used \ in conjunction with the 'login' or 'logout'")}] -class sync(share_cmd): +class sync_cmd(share_cmd): def __init__(self): # Объект опций командной строки self.optobj = opt(\ @@ -58,7 +58,6 @@ class sync(share_cmd): comment_examples=COMMENT_EXAMPLES, description=DESCRIPTION, option_list=CMD_OPTIONS + opt.variable_control+opt.color_control, - formatter=TitledHelpFormatter(), check_values=self.checkOpts) # Создаем объект логики self.logicObj = client() diff --git a/scripts/cl-sync-2.2 b/scripts/cl-sync-2.2 index bdf8c41..9cfc9c5 100644 --- a/scripts/cl-sync-2.2 +++ b/scripts/cl-sync-2.2 @@ -21,7 +21,7 @@ sys.path.insert(0,os.path.abspath('/usr/lib/calculate-2.2/calculate-lib/pym')) sys.path.insert(0,\ 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 tr = lang() @@ -29,7 +29,7 @@ tr.setGlobalDomain('cl_desktop') tr.setLanguage(sys.modules[__name__]) if __name__ == "__main__": - obj = sync() + obj = sync_cmd() ret = obj.optobj.parse_args() if ret is False: sys.exit(1) From 2d89e8ab59e2a124ae208796ed774d8f7130d426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Thu, 3 Jun 2010 10:54:29 +0400 Subject: [PATCH 8/8] Rename scripts --- scripts/{cl-client-2.2 => cl-client} | 0 scripts/{cl-sync-2.2 => cl-sync} | 0 setup.py | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename scripts/{cl-client-2.2 => cl-client} (100%) rename scripts/{cl-sync-2.2 => cl-sync} (100%) diff --git a/scripts/cl-client-2.2 b/scripts/cl-client similarity index 100% rename from scripts/cl-client-2.2 rename to scripts/cl-client diff --git a/scripts/cl-sync-2.2 b/scripts/cl-sync similarity index 100% rename from scripts/cl-sync-2.2 rename to scripts/cl-sync diff --git a/setup.py b/setup.py index 46c2ead..5473e22 100755 --- a/setup.py +++ b/setup.py @@ -141,8 +141,8 @@ setup( package_dir = {'calculate-client': "."}, packages = ['calculate-client.pym'], data_files = data_files, - scripts=["./scripts/cl-sync-2.2", - "./scripts/cl-client-2.2", + scripts=["./scripts/cl-sync", + "./scripts/cl-client", "./scripts/install", "./scripts/uninstall"], ext_modules = [Extension('calculate-client.pym._cl_keys',