mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
Added logs with translation for gsettings_applier
This commit is contained in:
parent
d26eaca24f
commit
5d34a51e07
@ -21,7 +21,7 @@ import os
|
||||
import logging
|
||||
from gi.repository import Gio, GLib
|
||||
|
||||
from util.logging import slogm
|
||||
from util.logging import slogm, log
|
||||
|
||||
class system_gsetting:
|
||||
def __init__(self, schema, path, value, lock, helper_function=None):
|
||||
@ -66,11 +66,17 @@ class system_gsettings:
|
||||
|
||||
for gsetting in self.gsettings:
|
||||
settings = Gio.Settings(schema=gsetting.schema)
|
||||
logging.debug(slogm('Applying machine setting {}.{} to {} {}'.format(gsetting.schema,
|
||||
gsetting.path,
|
||||
gsetting.value,
|
||||
gsetting.value,
|
||||
'locked' if gsetting.lock else 'unlocked')))
|
||||
logdata = dict()
|
||||
logdata['gsetting.schema'] = gsetting.schema
|
||||
logdata['gsetting.path'] = gsetting.path
|
||||
logdata['gsetting.value'] = gsetting.value
|
||||
logdata['gsetting.lock'] = gsetting.lock
|
||||
log('D89', logdata)
|
||||
#logging.debug(slogm('Applying machine setting {}.{} to {} {}'.format(gsetting.schema,
|
||||
# gsetting.path,
|
||||
# gsetting.value,
|
||||
# gsetting.value,
|
||||
# 'locked' if gsetting.lock else 'unlocked')))
|
||||
gsetting.apply(settings, config, self.locks)
|
||||
|
||||
with open(self.override_file_path, 'w') as f:
|
||||
|
@ -35,7 +35,7 @@ from .appliers.gsettings import (
|
||||
system_gsettings,
|
||||
user_gsetting
|
||||
)
|
||||
from util.logging import slogm
|
||||
from util.logging import slogm ,log
|
||||
|
||||
def uri_fetch(schema, path, value, cache):
|
||||
'''
|
||||
@ -49,7 +49,8 @@ def uri_fetch(schema, path, value, cache):
|
||||
try:
|
||||
retval = cache.get(value)
|
||||
logdata['dst'] = retval
|
||||
logging.debug(slogm('Getting cached file for URI: {}'.format(logdata)))
|
||||
log('D90', logdata)
|
||||
#logging.debug(slogm('Getting cached file for URI: {}'.format(logdata)))
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
@ -91,7 +92,8 @@ class gsettings_applier(applier_frontend):
|
||||
except Exception as exc:
|
||||
logdata = dict()
|
||||
logdata['exception'] = str(exc)
|
||||
logging.debug(slogm('Unable to cache specified URI for machine: {}'.format(logdata)))
|
||||
log('E47', logdata)
|
||||
#logging.debug(slogm('Unable to cache specified URI for machine: {}'.format(logdata)))
|
||||
|
||||
def uri_fetch_helper(self, schema, path, value):
|
||||
return uri_fetch(schema, path, value, self.file_cache)
|
||||
@ -103,7 +105,8 @@ class gsettings_applier(applier_frontend):
|
||||
|
||||
# Cleanup settings from previous run
|
||||
if os.path.exists(self.override_file):
|
||||
logging.debug(slogm('Removing GSettings policy file from previous run'))
|
||||
log('D82')
|
||||
#logging.debug(slogm('Removing GSettings policy file from previous run'))
|
||||
os.remove(self.override_file)
|
||||
|
||||
# Get all configured gsettings locks
|
||||
@ -134,20 +137,24 @@ class gsettings_applier(applier_frontend):
|
||||
try:
|
||||
proc = subprocess.run(args=['/usr/bin/glib-compile-schemas', self.__global_schema], capture_output=True, check=True)
|
||||
except Exception as exc:
|
||||
logging.debug(slogm('Error recompiling global GSettings schemas'))
|
||||
log('E48')
|
||||
#logging.debug(slogm('Error recompiling global GSettings schemas'))
|
||||
|
||||
# Update desktop configuration system backend
|
||||
try:
|
||||
proc = subprocess.run(args=['/usr/bin/dconf', "update"], capture_output=True, check=True)
|
||||
except Exception as exc:
|
||||
logging.debug(slogm('Error update desktop configuration system backend'))
|
||||
log('E49')
|
||||
#logging.debug(slogm('Error update desktop configuration system backend'))
|
||||
|
||||
def apply(self):
|
||||
if self.__module_enabled:
|
||||
logging.debug(slogm('Running GSettings applier for machine'))
|
||||
log('D80')
|
||||
#logging.debug(slogm('Running GSettings applier for machine'))
|
||||
self.run()
|
||||
else:
|
||||
logging.debug(slogm('GSettings applier for machine will not be started'))
|
||||
log('D81')
|
||||
#logging.debug(slogm('GSettings applier for machine will not be started'))
|
||||
|
||||
class GSettingsMapping:
|
||||
def __init__(self, hive_key, gsettings_schema, gsettings_key):
|
||||
@ -165,7 +172,8 @@ class GSettingsMapping:
|
||||
logdata['hive_key'] = self.hive_key
|
||||
logdata['gsettings_schema'] = self.gsettings_schema
|
||||
logdata['gsettings_key'] = self.gsettings_key
|
||||
logging.warning(slogm('Unable to resolve GSettings parameter {}.{}'.format(self.gsettings_schema, self.gsettings_key)))
|
||||
log('W6', logdata)
|
||||
#logging.warning(slogm('Unable to resolve GSettings parameter {}.{}'.format(self.gsettings_schema, self.gsettings_key)))
|
||||
|
||||
def preg2gsettings(self):
|
||||
'''
|
||||
@ -237,7 +245,11 @@ class gsettings_applier_user(applier_frontend):
|
||||
for setting_key in self.__windows_settings.keys():
|
||||
value = self.storage.get_hkcu_entry(self.sid, setting_key)
|
||||
if value:
|
||||
logging.debug(slogm('Found GSettings windows mapping {} to {}'.format(setting_key, value.data)))
|
||||
logdata = dict()
|
||||
logdata['setting_key'] = setting_key
|
||||
logdata['value.data'] = value.data
|
||||
log('D86', logdata)
|
||||
#logging.debug(slogm('Found GSettings windows mapping {} to {}'.format(setting_key, value.data)))
|
||||
mapping = self.__windows_settings[setting_key]
|
||||
try:
|
||||
self.gsettings.append(user_gsetting(mapping.gsettings_schema, mapping.gsettings_key, value.data))
|
||||
@ -258,10 +270,12 @@ class gsettings_applier_user(applier_frontend):
|
||||
|
||||
# Calculate all mapped gsettings if mapping enabled
|
||||
if self.__windows_mapping_enabled:
|
||||
logging.debug(slogm('Mapping Windows policies to GSettings policies'))
|
||||
log('D83')
|
||||
#logging.debug(slogm('Mapping Windows policies to GSettings policies'))
|
||||
self.windows_mapping_append()
|
||||
else:
|
||||
logging.debug(slogm('GSettings windows policies mapping not enabled'))
|
||||
log('D84')
|
||||
#logging.debug(slogm('GSettings windows policies mapping not enabled'))
|
||||
|
||||
# Calculate all configured gsettings
|
||||
for setting in self.gsettings_keys:
|
||||
@ -277,17 +291,24 @@ class gsettings_applier_user(applier_frontend):
|
||||
|
||||
# Create GSettings policy with highest available priority
|
||||
for gsetting in self.gsettings:
|
||||
logging.debug(slogm('Applying user setting {}.{} to {}'.format(gsetting.schema,
|
||||
gsetting.path,
|
||||
gsetting.value)))
|
||||
logdata = dict()
|
||||
logdata['gsetting.schema'] = gsetting.schema
|
||||
logdata['gsetting.path'] = gsetting.path
|
||||
logdata['gsetting.value'] = gsetting.value
|
||||
log('D85', logdata)
|
||||
#logging.debug(slogm('Applying user setting {}.{} to {}'.format(gsetting.schema,
|
||||
# gsetting.path,
|
||||
# gsetting.value)))
|
||||
gsetting.apply()
|
||||
|
||||
def user_context_apply(self):
|
||||
if self.__module_enabled:
|
||||
logging.debug(slogm('Running GSettings applier for user in user context'))
|
||||
log('D87')
|
||||
#logging.debug(slogm('Running GSettings applier for user in user context'))
|
||||
self.run()
|
||||
else:
|
||||
logging.debug(slogm('GSettings applier for user in user context will not be started'))
|
||||
log('D88')
|
||||
#logging.debug(slogm('GSettings applier for user in user context will not be started'))
|
||||
|
||||
def admin_context_apply(self):
|
||||
# Cache files on remote locations
|
||||
@ -299,5 +320,6 @@ class gsettings_applier_user(applier_frontend):
|
||||
except Exception as exc:
|
||||
logdata = dict()
|
||||
logdata['exception'] = str(exc)
|
||||
logging.debug(slogm('Unable to cache specified URI for user: {}'.format(logdata)))
|
||||
log('E50', logdata)
|
||||
#logging.debug(slogm('Unable to cache specified URI for user: {}'.format(logdata)))
|
||||
|
||||
|
@ -171,6 +171,20 @@ msgstr "Невозможно запустить systemd unit"
|
||||
msgid "Unable to cache specified URI"
|
||||
msgstr "Невозможно кэшировать указанный URI"
|
||||
|
||||
msgid "Unable to cache specified URI for machine"
|
||||
msgstr "Невозможно кэшировать указанный URI для компьютера"
|
||||
|
||||
msgid "Error recompiling global GSettings schemas"
|
||||
msgstr "Ошибка перекомпиляции глобальных GSettings schemas"
|
||||
|
||||
msgid "Error update configuration dconf"
|
||||
msgstr "Ошибка обновления конфигурации dconf"
|
||||
|
||||
msgid "Unable to cache specified URI for user"
|
||||
msgstr "Невозможно кэшировать указанный URI для пользователя"
|
||||
|
||||
# Error_end
|
||||
|
||||
# Debug
|
||||
msgid "The GPOA process was started for user"
|
||||
msgstr "Произведён запуск GPOA для обновления политик пользователя"
|
||||
@ -373,6 +387,44 @@ msgstr "Начато применение настроек systemd для маш
|
||||
msgid "Running systemd applier for machine will not be started"
|
||||
msgstr "Применение настроек systemd для машины не удалось"
|
||||
|
||||
msgid "Running GSettings applier for machine"
|
||||
msgstr "Запуск применение настроек GSettings для машины"
|
||||
|
||||
msgid "GSettings applier for machine will not be started"
|
||||
msgstr "Применение настроек GSettings для машины не удалось"
|
||||
|
||||
msgid "Removing GSettings policy file from previous run"
|
||||
msgstr "Удаление файла политики GSettings из предыдущего запуска"
|
||||
|
||||
msgid "Mapping Windows policies to GSettings policies"
|
||||
msgstr "Сопоставление политик Windows с политиками GSettings"
|
||||
|
||||
msgid "GSettings windows policies mapping not enabled"
|
||||
msgstr "Сопоставление политик Windows GSettings не включено"
|
||||
|
||||
msgid "Applying user setting"
|
||||
msgstr "Применение пользовательских настроек"
|
||||
|
||||
msgid "Found GSettings windows mapping"
|
||||
msgstr "Найдены соответствия настроек windows-GSettings"
|
||||
|
||||
msgid "Running GSettings applier for user in user context"
|
||||
msgstr "Запуск применение настроек GSettings в контексте пользователя"
|
||||
|
||||
msgid "GSettings applier for user in user context will not be started"
|
||||
msgstr "GSettings в контексте пользователя не запускается"
|
||||
|
||||
msgid "Applying machine setting"
|
||||
msgstr "Применение настройки машины"
|
||||
|
||||
msgid "Path not resolved as UNC URI"
|
||||
msgstr "Путь не разрешен"
|
||||
|
||||
msgid "Getting cached file for URI"
|
||||
msgstr "Получение кешированного файла для URI"
|
||||
|
||||
|
||||
# Debug_end
|
||||
|
||||
# Warning
|
||||
msgid "Unable to perform gpupdate for non-existent user, will update machine settings"
|
||||
@ -394,6 +446,9 @@ msgstr "Пакет ADP не установлен, плагин не будет
|
||||
msgid "Unknown warning code"
|
||||
msgstr "Неизвестный код предупреждения"
|
||||
|
||||
msgid "Unable to resolve GSettings parameter"
|
||||
msgstr "Не удалось установить параметр GSettings"
|
||||
|
||||
# Fatal
|
||||
msgid "Unable to refresh GPO list"
|
||||
msgstr "Невозможно обновить список объектов групповых политик"
|
||||
|
@ -78,7 +78,11 @@ def error_code(code):
|
||||
error_ids[44] = 'Unable to generate file'
|
||||
error_ids[45] = 'Failed applying unit'
|
||||
error_ids[46] = 'Unable to start systemd unit'
|
||||
|
||||
error_ids[47] = 'Unable to cache specified URI for machine'
|
||||
error_ids[48] = 'Error recompiling global GSettings schemas'
|
||||
error_ids[49] = 'Error update configuration dconf'
|
||||
error_ids[50] = 'Unable to cache specified URI for user'
|
||||
|
||||
return error_ids.get(code, 'Unknown error code')
|
||||
|
||||
def debug_code(code):
|
||||
@ -162,7 +166,18 @@ def debug_code(code):
|
||||
debug_ids[77] = 'Generated file'
|
||||
debug_ids[78] = 'Running systemd applier for machine'
|
||||
debug_ids[79] = 'Running systemd applier for machine will not be started'
|
||||
|
||||
debug_ids[80] = 'Running GSettings applier for machine'
|
||||
debug_ids[81] = 'GSettings applier for machine will not be started'
|
||||
debug_ids[82] = 'Removing GSettings policy file from previous run'
|
||||
debug_ids[83] = 'Mapping Windows policies to GSettings policies'
|
||||
debug_ids[84] = 'GSettings windows policies mapping not enabled'
|
||||
debug_ids[85] = 'Applying user setting'
|
||||
debug_ids[86] = 'Found GSettings windows mapping'
|
||||
debug_ids[87] = 'Running GSettings applier for user in user context'
|
||||
debug_ids[88] = 'GSettings applier for user in user context will not be started'
|
||||
debug_ids[89] = 'Applying machine setting'
|
||||
debug_ids[90] = 'Getting cached file for URI'
|
||||
|
||||
return debug_ids.get(code, 'Unknown debug code')
|
||||
|
||||
def warning_code(code):
|
||||
@ -178,6 +193,7 @@ def warning_code(code):
|
||||
warning_ids[3] = 'oddjobd is inaccessible'
|
||||
warning_ids[4] = 'No SYSVOL entry assigned to GPO'
|
||||
warning_ids[5] = 'ADP package is not installed - plugin will not be initialized'
|
||||
warning_ids[6] = 'Unable to resolve GSettings parameter'
|
||||
|
||||
return warning_ids.get(code, 'Unknown warning code')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user