|
|
|
@ -24,7 +24,10 @@ from cl_log import log
|
|
|
|
|
import cl_datavars
|
|
|
|
|
import cl_template
|
|
|
|
|
from cl_print import color_print as old_color_print
|
|
|
|
|
from cl_utils import runOsCommand, scanDirectory, pathJoin
|
|
|
|
|
from cl_utils import runOsCommand, scanDirectory, pathJoin, getPasswdUsers, \
|
|
|
|
|
listDirectory
|
|
|
|
|
import pwd
|
|
|
|
|
from os import path
|
|
|
|
|
import cl_overriding
|
|
|
|
|
from cl_utils import getModeFile
|
|
|
|
|
|
|
|
|
@ -217,14 +220,30 @@ class updateUserConfigs(shareUpdateConfigs):
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("Can not execute 'who'"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
return xUsers
|
|
|
|
|
|
|
|
|
|
def getConfiguredPasswdUsers(self):
|
|
|
|
|
"""
|
|
|
|
|
Get users from passwd and discard users which has not
|
|
|
|
|
.calculate/ini.env.
|
|
|
|
|
"""
|
|
|
|
|
USER,DIR = 0,1
|
|
|
|
|
iniEnv = ".calculate/ini.env"
|
|
|
|
|
return map(lambda x:x[USER],
|
|
|
|
|
filter(lambda x:path.exists(path.join(x[DIR],iniEnv)),
|
|
|
|
|
map(lambda x:(x,pwd.getpwnam(x).pw_dir),
|
|
|
|
|
getPasswdUsers())))
|
|
|
|
|
|
|
|
|
|
def updateConfig(self, nameProgram, category, version):
|
|
|
|
|
"""Обновление конфигурационных файлов у пользователей"""
|
|
|
|
|
# флаг обновления и программы используемые для наложения шаблонов
|
|
|
|
|
flagUpdate, mergePrograms = self.getFlagUpdAndInstPrograms()
|
|
|
|
|
# Пользователи в X сессии
|
|
|
|
|
xUsers = self.getXUsers()
|
|
|
|
|
# X session user + configured local users (if user profile was not
|
|
|
|
|
# configured then there is no need setup package for this user
|
|
|
|
|
# discard run for root user
|
|
|
|
|
xUsers = list((set(self.getXUsers()) |
|
|
|
|
|
set(self.getConfiguredPasswdUsers()))-set(["root"]))
|
|
|
|
|
if not xUsers:
|
|
|
|
|
self.logger.info(_("Package %s") %nameProgram)
|
|
|
|
|
self.logger.warn(_("Not found X sessions users"))
|
|
|
|
|