mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
Added interactivity to work with /usr/bin/net in netshare.py
This commit is contained in:
parent
b7e61e4ab8
commit
abcc660118
@ -30,6 +30,7 @@ class Networkshare:
|
||||
|
||||
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
|
||||
if username:
|
||||
@ -46,11 +47,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)
|
||||
|
@ -774,6 +774,9 @@ msgstr "Запуск применение настроек сетевых кат
|
||||
msgid "Running networkshare applier for user will not be started"
|
||||
msgstr "Применение настроек сетевых каталогов для пользователя не будет запущено"
|
||||
|
||||
msgid "Applying settings for network share"
|
||||
msgstr "Применение настроек для сетевой папки"
|
||||
|
||||
# Debug_end
|
||||
|
||||
# Warning
|
||||
|
@ -294,6 +294,7 @@ def debug_code(code):
|
||||
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