Изменена логика работы с объединяемыми системными профилями.

develop
Самоукин Алексей 15 years ago
parent bc95a093cf
commit 386ccd97af

@ -0,0 +1 @@
# Calculate cl_name==calculate-client&cl_action==profiles_client

@ -0,0 +1 @@
# Calculate cl_name==calculate-client&cl_action==profiles_domain

@ -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): 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): def __init__(self, cmdName):
# объект для форматированного вывода # объект для форматированного вывода
imp_cl_help.__init__(self, cmdName) imp_cl_help.__init__(self, cmdName)
@ -956,6 +961,20 @@ conjunction with the 'login' or 'logout'")
return False return False
return True 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): 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_remote_host","",True)
# Изменяем базовую директорию наложения профилей # Изменяем базовую директорию наложения профилей
self.clVars.Set("cl_root_path","/",True) self.clVars.Set("cl_root_path","/",True)
# Устанавливаем действие profiles_domain
self.clVars.Set("cl_action","profiles_domain",True)
# Наложим профили profiles/domain # Наложим профили profiles/domain
# Новые пути к профилям # Новые пути к профилям
profPaths=[\ profPaths = self.getPathProfiles(self.rootProfilePaths)
'/usr/lib/calculate/calculate-client/profiles/domain', if not profPaths:
'/var/calculate/remote/profiles/domain', self.printERROR(_("Empty profile paths %s")\
'/var/calculate/profiles/domain'] %", "(self.rootProfilePaths))
return False
# Изменяем переменную хранения профилей # Изменяем переменную хранения профилей
self.clVars.Set("cl_profile_path",profPaths,True) 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) self.clVars.Set("cl_root_path","/",True)
# Наложим профили profiles/domain # Наложим профили profiles/domain
# Новые пути к профилям # Новые пути к профилям
profPaths=['/usr/lib/calculate/calculate-client/profiles/domain', # Устанавливаем действие profiles_domain
'/var/calculate/remote/profiles/domain', clVars.Set("cl_action","profiles_domain",True)
'/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) 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 + " ...") self.printOK(_("Computer removed from domain %s")%domain + " ...")
return True return True
def getProfilePath(self, profPaths):
"""список накладываемых профилей"""
profpath = []
for profPath in profPaths:
if os.path.exists(profPath):
profpath.append(profPath)
return profpath
def uninstallClient(self): def uninstallClient(self):
"""Наложение профиля клиента по умолчанию и """Наложение профиля клиента по умолчанию и
@ -1141,10 +1161,14 @@ manager") + " ..."
clVars.Set("cl_pass_step","uninstall",True) clVars.Set("cl_pass_step","uninstall",True)
# Изменяем базовую директорию наложения профилей # Изменяем базовую директорию наложения профилей
clVars.Set("cl_root_path","/",True) clVars.Set("cl_root_path","/",True)
# Устанавливаем действие profiles_client
clVars.Set("cl_action","profiles_client",True)
# Новые пути к профилям # Новые пути к профилям
profPaths=['/usr/lib/calculate/calculate-client/profiles/client', profPaths = self.getPathProfiles(self.rootProfilePaths)
'/var/calculate/remote/profiles/client', if not profPaths:
'/var/calculate/profiles/client'] self.printERROR(_("Empty profile paths %s")\
%", "(self.rootProfilePaths))
return False
# Изменяем переменную хранения профилей # Изменяем переменную хранения профилей
clVars.Set("cl_profile_path",profPaths,True) clVars.Set("cl_profile_path",profPaths,True)
# Наложим профили # Наложим профили
@ -1173,10 +1197,14 @@ manager") + " ..."
clVars.Set("cl_pass_step","install",True) clVars.Set("cl_pass_step","install",True)
# Изменяем базовую директорию наложения профилей # Изменяем базовую директорию наложения профилей
clVars.Set("cl_root_path","/",True) clVars.Set("cl_root_path","/",True)
# Устанавливаем действие profiles_client
clVars.Set("cl_action","profiles_client",True)
# Новые пути к профилям # Новые пути к профилям
profPaths=['/usr/lib/calculate/calculate-client/profiles/client', profPaths = self.getPathProfiles(self.rootProfilePaths)
'/var/calculate/remote/profiles/client', if not profPaths:
'/var/calculate/profiles/client'] self.printERROR(_("Empty profile paths %s")\
%", "(self.rootProfilePaths))
return False
# Изменяем переменную хранения профилей # Изменяем переменную хранения профилей
clVars.Set("cl_profile_path",profPaths,True) 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): if not self.installClient(self.clVars, False):
return False return False
# Наложим профили profiles/domain # Наложим профили profiles/domain
# Устанавливаем действие profiles_client
clVars.Set("cl_action","profiles_domain",True)
# Новые пути к профилям # Новые пути к профилям
profPaths=['/usr/lib/calculate/calculate-client/profiles/domain', profPaths = self.getPathProfiles(self.rootProfilePaths)
'/var/calculate/remote/profiles/domain', if not profPaths:
'/var/calculate/profiles/domain'] self.printERROR(_("Empty profile paths %s")\
%", "(self.rootProfilePaths))
return False
# Изменяем переменную хранения профилей # Изменяем переменную хранения профилей
self.clVars.Set("cl_profile_path",profPaths,True) self.clVars.Set("cl_profile_path",profPaths,True)
# Наложим профили # Наложим профили

@ -27,7 +27,6 @@ class fillVars(object, cl_base.glob_attr):
def get_cl_profile_path(self): def get_cl_profile_path(self):
"""список накладываемых профилей при установке, наложении профилей""" """список накладываемых профилей при установке, наложении профилей"""
profpath = [] profpath = []
osLinuxName = self.Get("os_linux_shortname")
profPaths=['/usr/lib/calculate/calculate-client/client-profiles', profPaths=['/usr/lib/calculate/calculate-client/client-profiles',
'/var/calculate/remote/client-profiles', '/var/calculate/remote/client-profiles',
'/var/calculate/client-profiles'] '/var/calculate/client-profiles']

Loading…
Cancel
Save