mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0dacf2f657
@ -26,14 +26,15 @@ from util.logging import log
|
||||
from util.windows import expand_windows_var
|
||||
|
||||
|
||||
|
||||
class Networkshare:
|
||||
|
||||
def __init__(self, networkshare_obj):
|
||||
def __init__(self, networkshare_obj, username = None):
|
||||
self.net_full_cmd = ['/usr/bin/net', 'usershare']
|
||||
self.net_cmd_check = ['/usr/bin/net', 'usershare', 'list']
|
||||
self.cmd = list()
|
||||
self.name = networkshare_obj.name
|
||||
self.path = expand_windows_var(networkshare_obj.path).replace('\\', '/') if networkshare_obj.path else None
|
||||
self.path = expand_windows_var(networkshare_obj.path, username).replace('\\', '/') if networkshare_obj.path else None
|
||||
|
||||
self.action = action_letter2enum(networkshare_obj.action)
|
||||
self.allRegular = networkshare_obj.allRegular
|
||||
self.comment = networkshare_obj.comment
|
||||
@ -43,11 +44,22 @@ class Networkshare:
|
||||
self.acl = 'Everyone:'
|
||||
self.act()
|
||||
|
||||
def _run_net_full_cmd(self):
|
||||
def check_list_net(self):
|
||||
try:
|
||||
subprocess.call(self.net_full_cmd, stderr=subprocess.DEVNULL)
|
||||
res = subprocess.check_output(self.net_cmd_check, encoding='utf-8')
|
||||
return res
|
||||
except Exception as exc:
|
||||
return exc
|
||||
|
||||
def _run_net_full_cmd(self):
|
||||
logdata = dict()
|
||||
try:
|
||||
res = subprocess.check_output(self.net_full_cmd, stderr=subprocess.DEVNULL, encoding='utf-8')
|
||||
if res:
|
||||
logdata['cmd'] = self.net_full_cmd
|
||||
logdata['answer'] = res
|
||||
log('D190', logdata)
|
||||
except Exception as exc:
|
||||
logdata = dict()
|
||||
logdata['cmd'] = self.net_full_cmd
|
||||
logdata['exc'] = exc
|
||||
log('D182', logdata)
|
||||
@ -58,7 +70,7 @@ class Networkshare:
|
||||
self.net_full_cmd.append(self.name)
|
||||
self.net_full_cmd.append(self.path)
|
||||
self.net_full_cmd.append(self.comment)
|
||||
self.net_full_cmd.append(self.acl + 'F' if self.abe == 'ENABLE' else self.acl + 'R')
|
||||
self.net_full_cmd.append(self.acl + 'F')
|
||||
self.net_full_cmd.append(self._guest)
|
||||
self._run_net_full_cmd()
|
||||
|
||||
|
@ -180,6 +180,7 @@ class frontend_manager:
|
||||
self.user_appliers['package'] = package_applier_user(self.storage, self.sid, self.username)
|
||||
self.user_appliers['polkit'] = polkit_applier_user(self.storage, self.sid, self.username)
|
||||
self.user_appliers['envvar'] = envvar_applier_user(self.storage, self.sid, self.username)
|
||||
self.user_appliers['networkshare'] = networkshare_applier(self.storage, self.sid, self.username)
|
||||
self.user_appliers['scripts'] = scripts_applier_user(self.storage, self.sid, self.username)
|
||||
self.user_appliers['files'] = file_applier_user(self.storage, self.file_cache, self.sid, self.username)
|
||||
self.user_appliers['ini'] = ini_applier_user(self.storage, self.sid, self.username)
|
||||
|
@ -25,18 +25,21 @@ from util.logging import log
|
||||
|
||||
class networkshare_applier(applier_frontend):
|
||||
__module_name = 'NetworksharesApplier'
|
||||
__module_name_user = 'NetworksharesApplierUser'
|
||||
__module_experimental = True
|
||||
__module_enabled = False
|
||||
|
||||
def __init__(self, storage, sid):
|
||||
def __init__(self, storage, sid, username = None):
|
||||
self.storage = storage
|
||||
self.sid = sid
|
||||
self.username = username
|
||||
self.networkshare_info = self.storage.get_networkshare(self.sid)
|
||||
self.__module_enabled = check_enabled(self.storage, self.__module_name, self.__module_experimental)
|
||||
self.__module_enabled_user = check_enabled(self.storage, self.__module_name_user, self.__module_experimental)
|
||||
|
||||
def run(self):
|
||||
for networkshar in self.networkshare_info:
|
||||
Networkshare(networkshar)
|
||||
for networkshare in self.networkshare_info:
|
||||
Networkshare(networkshare, self.username)
|
||||
|
||||
def apply(self):
|
||||
if self.__module_enabled:
|
||||
@ -44,3 +47,12 @@ class networkshare_applier(applier_frontend):
|
||||
self.run()
|
||||
else:
|
||||
log('D181')
|
||||
def admin_context_apply(self):
|
||||
pass
|
||||
|
||||
def user_context_apply(self):
|
||||
if self.__module_enabled_user:
|
||||
log('D188')
|
||||
self.run()
|
||||
else:
|
||||
log('D189')
|
||||
|
@ -768,6 +768,15 @@ msgstr "Yandex_browser_applier для машины не запустится"
|
||||
msgid "Wrote YandexBrowser preferences to"
|
||||
msgstr "Запись настройки Яндекс Браузера в"
|
||||
|
||||
msgid "Running networkshare applier for user"
|
||||
msgstr "Запуск применение настроек сетевых каталогов для пользователя"
|
||||
|
||||
msgid "Running networkshare applier for user will not be started"
|
||||
msgstr "Применение настроек сетевых каталогов для пользователя не будет запущено"
|
||||
|
||||
msgid "Applying settings for network share"
|
||||
msgstr "Применение настроек для сетевой папки"
|
||||
|
||||
# Debug_end
|
||||
|
||||
# Warning
|
||||
|
@ -292,6 +292,9 @@ def debug_code(code):
|
||||
debug_ids[185] = 'Wrote YandexBrowser preferences to'
|
||||
debug_ids[186] = 'Saving information about network shares'
|
||||
debug_ids[187] = 'Running networkshare applier for machine'
|
||||
debug_ids[188] = 'Running networkshare applier for user'
|
||||
debug_ids[189] = 'Running networkshare applier for user will not be started'
|
||||
debug_ids[190] = 'Applying settings for network share'
|
||||
|
||||
return debug_ids.get(code, 'Unknown debug code')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user