mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-01-28 10:04:00 +03:00
commit
5d1cf84304
@ -25,6 +25,7 @@ from gpt.folders import (
|
||||
, action_letter2enum
|
||||
)
|
||||
from util.windows import expand_windows_var
|
||||
from util.util import get_homedir
|
||||
|
||||
def remove_dir_tree(path, delete_files=False, delete_folder=False, delete_sub_folders=False):
|
||||
content = list()
|
||||
@ -47,8 +48,12 @@ def str2bool(boolstr):
|
||||
|
||||
|
||||
class Folder:
|
||||
def __init__(self, folder_object, username):
|
||||
self.folder_path = Path(expand_windows_var(folder_object.path, username).replace('\\', '/'))
|
||||
def __init__(self, folder_object, username=None):
|
||||
folder_path = expand_windows_var(folder_object.path, username).replace('\\', '/')
|
||||
if username:
|
||||
self.folder_path = Path(get_homedir(username)).joinpath(folder_path if folder_path [0] != '/' else folder_path [1:])
|
||||
else:
|
||||
self.folder_path = Path(folder_path)
|
||||
self.action = action_letter2enum(folder_object.action)
|
||||
self.delete_files = str2bool(folder_object.delete_files)
|
||||
self.delete_folder = str2bool(folder_object.delete_folder)
|
||||
|
@ -23,10 +23,9 @@ from .applier_frontend import (
|
||||
, check_enabled
|
||||
)
|
||||
from .appliers.folder import Folder
|
||||
from util.logging import slogm, log
|
||||
from util.logging import log
|
||||
from util.windows import expand_windows_var
|
||||
import re
|
||||
import logging
|
||||
|
||||
class folder_applier(applier_frontend):
|
||||
__module_name = 'FoldersApplier'
|
||||
@ -47,9 +46,10 @@ class folder_applier(applier_frontend):
|
||||
win_var = re.findall(r'%.+?%', check)
|
||||
drive = re.findall(r'^[a-z A-Z]\:',check)
|
||||
if drive or win_var:
|
||||
log('D109', {"path": directory_obj.path})
|
||||
continue
|
||||
fld = Folder(directory_obj)
|
||||
fld.action()
|
||||
fld.act()
|
||||
else:
|
||||
log('D108')
|
||||
|
||||
@ -75,16 +75,13 @@ class folder_applier_user(applier_frontend):
|
||||
win_var = re.findall(r'%.+?%', check)
|
||||
drive = re.findall(r'^[a-z A-Z]\:',check)
|
||||
if drive or win_var:
|
||||
log('D110', {"path": directory_obj.path})
|
||||
continue
|
||||
fld = Folder(directory_obj, self.username)
|
||||
fld.act()
|
||||
|
||||
def admin_context_apply(self):
|
||||
if self.__module_enabled:
|
||||
log('D109')
|
||||
self.run()
|
||||
else:
|
||||
log('D110')
|
||||
pass
|
||||
|
||||
def user_context_apply(self):
|
||||
if self.__module_enabled:
|
||||
|
@ -525,11 +525,11 @@ msgstr "Запуск применение папок для машины"
|
||||
msgid "Folder applier for machine will not be started"
|
||||
msgstr "Применение папок для машины не запускается"
|
||||
|
||||
msgid "Running Folder applier for user in administrator context"
|
||||
msgstr "Запуск применение папок для пользователя в контексте администратора"
|
||||
msgid "Folder creation skipped for machine"
|
||||
msgstr "Создание папки для машины пропущено"
|
||||
|
||||
msgid "Folder applier for user in administrator context will not be started"
|
||||
msgstr "Применение папок для пользователя в контексте администратора не запускается"
|
||||
msgid "Folder creation skipped for user"
|
||||
msgstr "Создание папки для пользователя пропущено"
|
||||
|
||||
msgid "Running Folder applier for user in user context"
|
||||
msgstr "Запуск применение папок для пользователя в контексте пользователя"
|
||||
|
@ -214,8 +214,8 @@ def debug_code(code):
|
||||
debug_ids[106] = 'Applying shortcut file to'
|
||||
debug_ids[107] = 'Running Folder applier for machine'
|
||||
debug_ids[108] = 'Folder applier for machine will not be started'
|
||||
debug_ids[109] = 'Running Folder applier for user in administrator context'
|
||||
debug_ids[110] = 'Folder applier for user in administrator context will not be started'
|
||||
debug_ids[109] = 'Folder creation skipped for machine'
|
||||
debug_ids[110] = 'Folder creation skipped for user'
|
||||
debug_ids[111] = 'Running Folder applier for user in user context'
|
||||
debug_ids[112] = 'Folder applier for user in user context will not be started'
|
||||
debug_ids[113] = 'Running CUPS applier for machine'
|
||||
|
Loading…
x
Reference in New Issue
Block a user