|
|
|
@ -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)
|
|
|
|
|
# Наложим профили
|
|
|
|
|