mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
Added logs with translation for control_alt
This commit is contained in:
parent
87c5e1e75f
commit
12ee1d7a8b
@ -19,7 +19,7 @@
|
||||
import subprocess
|
||||
import threading
|
||||
import logging
|
||||
from util.logging import slogm
|
||||
from util.logging import slogm, log
|
||||
|
||||
def control_subst(preg_name):
|
||||
'''
|
||||
@ -68,7 +68,12 @@ class control:
|
||||
try:
|
||||
str_status = self.possible_values[int_status]
|
||||
except IndexError as exc:
|
||||
logging.error(slogm('Error getting control ({}) value from {} by index {}'.format(self.control_name, self.possible_values, int_status)))
|
||||
logdata = dict()
|
||||
logdata['control'] = self.control_name
|
||||
logdata['value from'] = self.possible_values
|
||||
logdata['by index'] = int_status
|
||||
log('E41', )
|
||||
#logging.error(slogm('Error getting control ({}) value from {} by index {}'.format(self.control_name, self.possible_values, int_status)))
|
||||
str_status = None
|
||||
|
||||
return str_status
|
||||
@ -93,20 +98,35 @@ class control:
|
||||
if type(self.control_value) == int:
|
||||
status = self._map_control_status(self.control_value)
|
||||
if status == None:
|
||||
logging.error(slogm('\'{}\' is not in possible values for control {}'.format(self.control_value, self.control_name)))
|
||||
logdata = dict()
|
||||
logdata['control'] = self.control_name
|
||||
logdata['inpossible values'] = self.self.control_value
|
||||
log('E42', logdata)
|
||||
#logging.error(slogm('\'{}\' is not in possible values for control {}'.format(self.control_value, self.control_name)))
|
||||
return
|
||||
elif type(self.control_value) == str:
|
||||
if self.control_value not in self.possible_values:
|
||||
logging.error(slogm('\'{}\' is not in possible values for control {}'.format(self.control_value, self.control_name)))
|
||||
logdata = dict()
|
||||
logdata['control'] = self.control_name
|
||||
logdata['inpossible values'] = self.self.control_value
|
||||
log('E42', logdata)
|
||||
#logging.error(slogm('\'{}\' is not in possible values for control {}'.format(self.control_value, self.control_name)))
|
||||
return
|
||||
status = self.control_value
|
||||
|
||||
logging.debug(slogm('Setting control {} to {}'.format(self.control_name, status)))
|
||||
logdata = dict()
|
||||
logdata['control'] = self.control_name
|
||||
logdata['status'] = status
|
||||
log('D68', logdata)
|
||||
#logging.debug(slogm('Setting control {} to {}'.format(self.control_name, status)))
|
||||
|
||||
try:
|
||||
popen_call = ['/usr/sbin/control', self.control_name, status]
|
||||
with subprocess.Popen(popen_call, stdout=subprocess.PIPE) as proc:
|
||||
proc.wait()
|
||||
except:
|
||||
logging.error(slogm('Unable to set {} to {}'.format(self.control_name, status)))
|
||||
logdata = dict()
|
||||
logdata['control'] = self.control_name
|
||||
logdata['status'] = status
|
||||
log('E43', logdata)
|
||||
#logging.error(slogm('Unable to set {} to {}'.format(self.control_name, status)))
|
||||
|
||||
|
@ -21,7 +21,7 @@ from .applier_frontend import (
|
||||
, check_enabled
|
||||
)
|
||||
from .appliers.control import control
|
||||
from util.logging import slogm
|
||||
from util.logging import slogm, log
|
||||
|
||||
import logging
|
||||
|
||||
@ -46,12 +46,24 @@ class control_applier(applier_frontend):
|
||||
valuename = setting.hive_key.rpartition('\\')[2]
|
||||
try:
|
||||
self.controls.append(control(valuename, int(setting.data)))
|
||||
logging.info(slogm('Working with control {}'.format(valuename)))
|
||||
logdata = dict()
|
||||
logdata['control'] = valuename
|
||||
logdata['value'] = setting.data
|
||||
log('I3', logdata)
|
||||
#logging.info(slogm('Working with control {}'.format(valuename)))
|
||||
except ValueError as exc:
|
||||
self.controls.append(control(valuename, setting.data))
|
||||
logging.info(slogm('Working with control {} with string value'.format(valuename)))
|
||||
logdata = dict()
|
||||
logdata['control'] = valuename
|
||||
logdata['with string value'] = setting.data
|
||||
log('I3', logdata)
|
||||
#logging.info(slogm('Working with control {} with string value'.format(valuename)))
|
||||
except Exception as exc:
|
||||
logging.info(slogm('Unable to work with control {}: {}'.format(valuename, exc)))
|
||||
logdata = dict()
|
||||
logdata['control'] = valuename
|
||||
logdata['exc'] = exc
|
||||
log('E39', logdata)
|
||||
#logging.info(slogm('Unable to work with control {}: {}'.format(valuename, exc)))
|
||||
#for e in polfile.pol_file.entries:
|
||||
# print('{}:{}:{}:{}:{}'.format(e.type, e.data, e.valuename, e.keyname))
|
||||
for cont in self.controls:
|
||||
@ -62,8 +74,10 @@ class control_applier(applier_frontend):
|
||||
Trigger control facility invocation.
|
||||
'''
|
||||
if self.__module_enabled:
|
||||
logging.debug(slogm('Running Control applier for machine'))
|
||||
log('D67')
|
||||
#logging.debug(slogm('Running Control applier for machine'))
|
||||
self.run()
|
||||
else:
|
||||
logging.debug(slogm('Control applier for machine will not be started'))
|
||||
log('E40')
|
||||
#logging.debug(slogm('Control applier for machine will not be started'))
|
||||
|
||||
|
@ -41,6 +41,9 @@ msgstr "Получен объект групповой политики"
|
||||
msgid "Unknown info code"
|
||||
msgstr "Неизвестный код информационного сообщения"
|
||||
|
||||
msgid "Working with control"
|
||||
msgstr "Применение настроек control"
|
||||
|
||||
# Error
|
||||
msgid "Insufficient permissions to run gpupdate"
|
||||
msgstr "Недостаточно прав для запуска gpupdate"
|
||||
@ -132,6 +135,21 @@ msgstr "Ошибка слияния пользовательской части
|
||||
msgid "Unknown error code"
|
||||
msgstr "Неизвестный код ошибки"
|
||||
|
||||
msgid "Unable to work with control"
|
||||
msgstr "Не удалось применить настройки control"
|
||||
|
||||
msgid "Control applier for machine will not be started"
|
||||
msgstr "Приминение Control для машины не удалось"
|
||||
|
||||
msgid "Error getting control"
|
||||
msgstr "Ошибка установки control"
|
||||
|
||||
msgid "Is not in possible values for control"
|
||||
msgstr "Не входит в возможные значения для control"
|
||||
|
||||
msgid "Unable to set"
|
||||
msgstr "Невозможно установить"
|
||||
|
||||
# Debug
|
||||
msgid "The GPOA process was started for user"
|
||||
msgstr "Произведён запуск GPOA для обновления политик пользователя"
|
||||
@ -295,6 +313,12 @@ msgstr "Сохранение информации о переменных окр
|
||||
msgid "Unknown debug code"
|
||||
msgstr "Неизвестный отладочный код"
|
||||
|
||||
msgid "Running Control applier for machine"
|
||||
msgstr "Начато применение Control для машины"
|
||||
|
||||
msgid "Setting control"
|
||||
msgstr "Установка control"
|
||||
|
||||
# Warning
|
||||
msgid "Unable to perform gpupdate for non-existent user, will update machine settings"
|
||||
msgstr "Невозможно запустить gpupdate для несуществующего пользователя, будут обновлены настройки машины"
|
||||
|
@ -23,7 +23,7 @@ def info_code(code):
|
||||
info_ids = dict()
|
||||
info_ids[1] = 'Got GPO list for username'
|
||||
info_ids[2] = 'Got GPO'
|
||||
|
||||
info_ids[3] = 'Working with control'
|
||||
return info_ids.get(code, 'Unknown info code')
|
||||
|
||||
def error_code(code):
|
||||
@ -66,6 +66,11 @@ def error_code(code):
|
||||
error_ids[36] = 'Error getting cached file for URI'
|
||||
error_ids[37] = 'Error caching file URIs'
|
||||
error_ids[38] = 'Unable to cache specified URI'
|
||||
error_ids[39] = 'Unable to work with control'
|
||||
error_ids[40] = 'Control applier for machine will not be started'
|
||||
error_ids[41] = 'Error getting control'
|
||||
error_ids[42] = 'Is not in possible values for control'
|
||||
error_ids[43] = 'Unable to set'
|
||||
|
||||
return error_ids.get(code, 'Unknown error code')
|
||||
|
||||
@ -137,6 +142,8 @@ def debug_code(code):
|
||||
debug_ids[64] = 'Delete HKCU branch key'
|
||||
debug_ids[65] = 'Delete HKLM branch key error'
|
||||
debug_ids[66] = 'Delete HKCU branch key error'
|
||||
debug_ids[67] = 'Running Control applier for machine'
|
||||
debug_ids[68] = 'Setting control'
|
||||
|
||||
return debug_ids.get(code, 'Unknown debug code')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user