1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Added object generation for all actions

This commit is contained in:
Valery Sinelnikov 2022-07-08 17:05:13 +04:00
parent b63fe63784
commit 95af821475

View File

@ -40,16 +40,16 @@ class file_applier(applier_frontend):
self.__module_enabled = check_enabled(self.storage, self.__module_name, self.__module_enabled)
def run(self):
dict_all_files = get_list_all_files(self.files, self.file_cache)
ls_files_cp = get_list_all_files(self.files, self.file_cache)
cp_all_files(ls_files_cp)
# def apply(self):
# if self.__module_enabled:
def apply(self):
if self.__module_enabled:
# log('#########D107#########')
# for file_obj in self.files:
# check_from = expand_windows_var(file_obj.fromPath).replace('\\', '/')
# check_target = expand_windows_var(file_obj.targetPath).replace('\\', '/')
# else:
self.run()
else:
pass
# log('#############D108')
class file_applier_user(applier_frontend):
@ -72,26 +72,30 @@ class file_applier_user(applier_frontend):
def run(self):
ls_files_cp = get_list_all_files(self.files, self.file_cache, self.username)
cp_all_files(ls_files_cp)
# def admin_context_apply(self):
# if self.__module_enabled:
def admin_context_apply(self):
if self.__module_enabled:
# log('###########D109')
# self.run()
# else:
self.run()
else:
pass
# log('############D110')
# def user_context_apply(self):
# if self.__module_enabled:
def user_context_apply(self):
if self.__module_enabled:
# log('##############D111')
# self.run()
# else:
self.run()
else:
pass
# log('#############D112')
def get_list_all_files(files, file_cache, username = None):
ls_files_cp = list()
for file_obj in files:
fromPath = expand_windows_var(file_obj.fromPath).replace('\\', '/')
targetPath = expand_windows_var(file_obj.targetPath).replace('\\', '/')
fromPath = (expand_windows_var(file_obj.fromPath, username).replace('\\', '/')
if file_obj.fromPath else None)
targetPath = expand_windows_var(file_obj.targetPath, username).replace('\\', '/')
dict_files_cp = dict()
dict_files_cp['targetPath'] = targetPath
dict_files_cp['action'] = file_obj.action
@ -99,27 +103,31 @@ def get_list_all_files(files, file_cache, username = None):
dict_files_cp['archive'] = file_obj.archive
dict_files_cp['hidden'] = file_obj.hidden
dict_files_cp['suppress'] = file_obj.suppress
if fromPath[-1] != '*':
if fromPath and fromPath[-1] != '*':
try:
file_cache.store(fromPath)
dict_files_cp['fromPath'] = file_cache.get(fromPath)
ls_files_cp.append(Files_cp(dict_files_cp))
except Exception as exc:
logdata = dict({fromPath: str(exc)})
log('W13', logdata)
ls_files_cp.append(Files_cp(dict_files_cp))
else:
elif fromPath:
ls_files = file_cache.get_ls_smbdir(fromPath[:-1])
ls_from_paths = [fromPath[:-1] + file_s for file_s in ls_files]
for from_path in ls_from_paths:
try:
file_cache.store(from_path)
dict_files_cp['fromPath'] = file_cache.get(from_path)
ls_files_cp.append(Files_cp(dict_files_cp))
except Exception as exc:
logdata = dict({from_path: str(exc)})
log('W13', logdata)
ls_files_cp.append(Files_cp(dict_files_cp))
else:
dict_files_cp['fromPath'] = fromPath
ls_files_cp.append(Files_cp(dict_files_cp))
return ls_files_cp
def cp_all_files(ls_files_cp):
ls_files_cp
pass