From 386ccd97afe446fc19928f4dbb18a7251dae8094 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 Sep 2009 16:10:15 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D0=BE=D0=B1=D1=8A=D0=B5?= =?UTF-8?q?=D0=B4=D0=B8=D0=BD=D1=8F=D0=B5=D0=BC=D1=8B=D0=BC=D0=B8=20=D1=81?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D0=BD=D1=8B=D0=BC=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8F=D0=BC=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- profiles/client/.calculate_directory | 1 + profiles/domain/.calculate_directory | 1 + pym/cl_client.py | 78 ++++++++++++++++++++-------- pym/cl_fill_client.py | 1 - 4 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 profiles/client/.calculate_directory create mode 100644 profiles/domain/.calculate_directory diff --git a/profiles/client/.calculate_directory b/profiles/client/.calculate_directory new file mode 100644 index 0000000..af36908 --- /dev/null +++ b/profiles/client/.calculate_directory @@ -0,0 +1 @@ +# Calculate cl_name==calculate-client&cl_action==profiles_client diff --git a/profiles/domain/.calculate_directory b/profiles/domain/.calculate_directory new file mode 100644 index 0000000..6834be5 --- /dev/null +++ b/profiles/domain/.calculate_directory @@ -0,0 +1 @@ +# Calculate cl_name==calculate-client&cl_action==profiles_domain diff --git a/pym/cl_client.py b/pym/cl_client.py index 36061bd..8eeca94 100644 --- a/pym/cl_client.py +++ b/pym/cl_client.py @@ -245,6 +245,11 @@ imp_cl_smcon = cl_utils2.cl_smartcon class cl_client(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon): """Основной класс для работы клиентских приложений""" + # Пути к профилям объединяемых с системными + # относительный путь при объединении '/' + rootProfilePaths=['/usr/lib/calculate/calculate-client/profiles', + '/var/calculate/remote/profiles', + '/var/calculate/profiles'] def __init__(self, cmdName): # объект для форматированного вывода imp_cl_help.__init__(self, cmdName) @@ -956,6 +961,20 @@ conjunction with the 'login' or 'logout'") return False return True + def getPathProfiles(self, listPath): + """Получаем список директорий хранения профилей""" + """список накладываемых профилей при установке, наложении профилей""" + profpath = [] + for profPath in listPath: + if os.path.isdir(profPath): + paths = os.listdir(profPath) + for path in paths: + ph = os.path.join(profPath,path) + filesAndDirs = os.listdir(ph) + if os.path.isdir(ph) and filesAndDirs: + profpath.append(ph) + return profpath + def applyRelevanceProfiles(self, hostAuth): """Накладывает релевантные профили @@ -968,12 +987,15 @@ conjunction with the 'login' or 'logout'") self.clVars.Set("cl_remote_host","",True) # Изменяем базовую директорию наложения профилей self.clVars.Set("cl_root_path","/",True) + # Устанавливаем действие profiles_domain + self.clVars.Set("cl_action","profiles_domain",True) # Наложим профили profiles/domain # Новые пути к профилям - profPaths=[\ - '/usr/lib/calculate/calculate-client/profiles/domain', - '/var/calculate/remote/profiles/domain', - '/var/calculate/profiles/domain'] + profPaths = self.getPathProfiles(self.rootProfilePaths) + if not profPaths: + self.printERROR(_("Empty profile paths %s")\ + %", "(self.rootProfilePaths)) + return False # Изменяем переменную хранения профилей self.clVars.Set("cl_profile_path",profPaths,True) # Наложим профили @@ -1104,9 +1126,14 @@ conjunction with the 'login' or 'logout'") self.clVars.Set("cl_root_path","/",True) # Наложим профили profiles/domain # Новые пути к профилям - profPaths=['/usr/lib/calculate/calculate-client/profiles/domain', - '/var/calculate/remote/profiles/domain', - '/var/calculate/profiles/domain'] + # Устанавливаем действие profiles_domain + clVars.Set("cl_action","profiles_domain",True) + # Новые пути к профилям + profPaths = self.getPathProfiles(self.rootProfilePaths) + if not profPaths: + self.printERROR(_("Empty profile paths %s")\ + %", "(self.rootProfilePaths)) + return False # Изменяем переменную хранения профилей self.clVars.Set("cl_profile_path",profPaths,True) # Наложим профили @@ -1119,13 +1146,6 @@ conjunction with the 'login' or 'logout'") self.printOK(_("Computer removed from domain %s")%domain + " ...") return True - def getProfilePath(self, profPaths): - """список накладываемых профилей""" - profpath = [] - for profPath in profPaths: - if os.path.exists(profPath): - profpath.append(profPath) - return profpath def uninstallClient(self): """Наложение профиля клиента по умолчанию и @@ -1141,10 +1161,14 @@ manager") + " ..." clVars.Set("cl_pass_step","uninstall",True) # Изменяем базовую директорию наложения профилей clVars.Set("cl_root_path","/",True) + # Устанавливаем действие profiles_client + clVars.Set("cl_action","profiles_client",True) # Новые пути к профилям - profPaths=['/usr/lib/calculate/calculate-client/profiles/client', - '/var/calculate/remote/profiles/client', - '/var/calculate/profiles/client'] + profPaths = self.getPathProfiles(self.rootProfilePaths) + if not profPaths: + self.printERROR(_("Empty profile paths %s")\ + %", "(self.rootProfilePaths)) + return False # Изменяем переменную хранения профилей clVars.Set("cl_profile_path",profPaths,True) # Наложим профили @@ -1173,10 +1197,14 @@ manager") + " ..." clVars.Set("cl_pass_step","install",True) # Изменяем базовую директорию наложения профилей clVars.Set("cl_root_path","/",True) + # Устанавливаем действие profiles_client + clVars.Set("cl_action","profiles_client",True) # Новые пути к профилям - profPaths=['/usr/lib/calculate/calculate-client/profiles/client', - '/var/calculate/remote/profiles/client', - '/var/calculate/profiles/client'] + profPaths = self.getPathProfiles(self.rootProfilePaths) + if not profPaths: + self.printERROR(_("Empty profile paths %s")\ + %", "(self.rootProfilePaths)) + return False # Изменяем переменную хранения профилей clVars.Set("cl_profile_path",profPaths,True) # Наложим профили @@ -1294,10 +1322,14 @@ or ld_bind_dn or ld_bind_pw") if not self.installClient(self.clVars, False): return False # Наложим профили profiles/domain + # Устанавливаем действие profiles_client + clVars.Set("cl_action","profiles_domain",True) # Новые пути к профилям - profPaths=['/usr/lib/calculate/calculate-client/profiles/domain', - '/var/calculate/remote/profiles/domain', - '/var/calculate/profiles/domain'] + profPaths = self.getPathProfiles(self.rootProfilePaths) + if not profPaths: + self.printERROR(_("Empty profile paths %s")\ + %", "(self.rootProfilePaths)) + return False # Изменяем переменную хранения профилей self.clVars.Set("cl_profile_path",profPaths,True) # Наложим профили diff --git a/pym/cl_fill_client.py b/pym/cl_fill_client.py index 3bb4ad0..9f30ec3 100644 --- a/pym/cl_fill_client.py +++ b/pym/cl_fill_client.py @@ -27,7 +27,6 @@ class fillVars(object, cl_base.glob_attr): def get_cl_profile_path(self): """список накладываемых профилей при установке, наложении профилей""" profpath = [] - osLinuxName = self.Get("os_linux_shortname") profPaths=['/usr/lib/calculate/calculate-client/client-profiles', '/var/calculate/remote/client-profiles', '/var/calculate/client-profiles']