1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-02-04 05:47:00 +03:00

Removed unnecessary comments

This commit is contained in:
Valery Sinelnikov 2021-10-05 16:27:03 +04:00
parent 5d34a51e07
commit 17d35b8f4d
8 changed files with 2 additions and 53 deletions

View File

@ -73,7 +73,6 @@ class control:
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
@ -102,7 +101,6 @@ class control:
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:
@ -110,14 +108,12 @@ class control:
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
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]
@ -128,5 +124,3 @@ class control:
logdata['control'] = self.control_name
logdata['status'] = status
log('E43', logdata)
#logging.error(slogm('Unable to set {} to {}'.format(self.control_name, status)))

View File

@ -72,11 +72,6 @@ class system_gsettings:
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:

View File

@ -50,11 +50,9 @@ class polkit:
logdata['file'] = self.outfile
logdata['arguments'] = self.args
log('D77', logdata)
#logging.debug(slogm('Generated file {} with arguments {}'.format(self.outfile, self.args)))
except Exception as exc:
logdata = dict()
logdata['file'] = self.outfile
logdata['arguments'] = self.args
log('E44', logdata)
#logging.error(slogm('Unable to generate file {} from {}'.format(self.outfile, self.infilename)))

View File

@ -42,7 +42,6 @@ class systemd_unit:
logdata = dict()
logdata['unit'] = self.unit_name
log('I6', logdata)
#logging.info(slogm('Starting systemd unit: {}'.format(self.unit_name)))
# In case the service has 'RestartSec' property set it
# switches to 'activating (auto-restart)' state instead of
@ -53,7 +52,6 @@ class systemd_unit:
logdata = dict()
logdata['unit'] = self.unit_name
log('E46', logdata)
#logging.error(slogm('Unable to start systemd unit {}'.format(self.unit_name)))
else:
self.manager.StopUnit(self.unit_name, 'replace')
self.manager.DisableUnitFiles([self.unit_name], dbus.Boolean(False))
@ -61,7 +59,6 @@ class systemd_unit:
logdata = dict()
logdata['unit'] = self.unit_name
log('I6', logdata)
#logging.info(slogm('Stopping systemd unit: {}'.format(self.unit_name)))
service_state = self._get_state()
@ -69,7 +66,6 @@ class systemd_unit:
logdata = dict()
logdata['unit'] = self.unit_name
log('E46', logdata)
#logging.error(slogm('Unable to stop systemd unit {}'.format(self.unit_name)))
def _get_state(self):
'''

View File

@ -50,20 +50,17 @@ class control_applier(applier_frontend):
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))
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:
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:
@ -75,9 +72,6 @@ class control_applier(applier_frontend):
'''
if self.__module_enabled:
log('D67')
#logging.debug(slogm('Running Control applier for machine'))
self.run()
else:
log('E40')
#logging.debug(slogm('Control applier for machine will not be started'))

View File

@ -50,7 +50,6 @@ def uri_fetch(schema, path, value, cache):
retval = cache.get(value)
logdata['dst'] = retval
log('D90', logdata)
#logging.debug(slogm('Getting cached file for URI: {}'.format(logdata)))
except Exception as exc:
pass
@ -93,7 +92,6 @@ class gsettings_applier(applier_frontend):
logdata = dict()
logdata['exception'] = str(exc)
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)
@ -106,7 +104,6 @@ class gsettings_applier(applier_frontend):
# Cleanup settings from previous run
if os.path.exists(self.override_file):
log('D82')
#logging.debug(slogm('Removing GSettings policy file from previous run'))
os.remove(self.override_file)
# Get all configured gsettings locks
@ -138,23 +135,19 @@ class gsettings_applier(applier_frontend):
proc = subprocess.run(args=['/usr/bin/glib-compile-schemas', self.__global_schema], capture_output=True, check=True)
except Exception as exc:
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:
log('E49')
#logging.debug(slogm('Error update desktop configuration system backend'))
def apply(self):
if self.__module_enabled:
log('D80')
#logging.debug(slogm('Running GSettings applier for machine'))
self.run()
else:
log('D81')
#logging.debug(slogm('GSettings applier for machine will not be started'))
class GSettingsMapping:
def __init__(self, hive_key, gsettings_schema, gsettings_key):
@ -173,7 +166,6 @@ class GSettingsMapping:
logdata['gsettings_schema'] = self.gsettings_schema
logdata['gsettings_key'] = self.gsettings_key
log('W6', logdata)
#logging.warning(slogm('Unable to resolve GSettings parameter {}.{}'.format(self.gsettings_schema, self.gsettings_key)))
def preg2gsettings(self):
'''
@ -249,7 +241,6 @@ class gsettings_applier_user(applier_frontend):
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))
@ -271,11 +262,9 @@ class gsettings_applier_user(applier_frontend):
# Calculate all mapped gsettings if mapping enabled
if self.__windows_mapping_enabled:
log('D83')
#logging.debug(slogm('Mapping Windows policies to GSettings policies'))
self.windows_mapping_append()
else:
log('D84')
#logging.debug(slogm('GSettings windows policies mapping not enabled'))
# Calculate all configured gsettings
for setting in self.gsettings_keys:
@ -296,19 +285,14 @@ class gsettings_applier_user(applier_frontend):
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:
log('D87')
#logging.debug(slogm('Running GSettings applier for user in user context'))
self.run()
else:
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
@ -321,5 +305,5 @@ class gsettings_applier_user(applier_frontend):
logdata = dict()
logdata['exception'] = str(exc)
log('E50', logdata)
#logging.debug(slogm('Unable to cache specified URI for user: {}'.format(logdata)))

View File

@ -41,14 +41,12 @@ class polkit_applier(applier_frontend):
template_file = self.__polkit_map[self.__deny_all][0]
template_vars = self.__polkit_map[self.__deny_all][1]
if deny_all:
#logging.debug(slogm('Deny_All setting found: {}'.format(deny_all.data)))
logdata = dict()
logdata['Deny_All'] = deny_all.data
log('D69', logdata)
self.__polkit_map[self.__deny_all][1]['Deny_All'] = deny_all.data
else:
log('D71')
#logging.debug(slogm('Deny_All setting not found'))
self.policies = []
self.policies.append(polkit(template_file, template_vars))
self.__module_enabled = check_enabled(
@ -63,12 +61,10 @@ class polkit_applier(applier_frontend):
'''
if self.__module_enabled:
log('D73')
#logging.debug(slogm('Running Polkit applier for machine'))
for policy in self.policies:
policy.generate()
else:
log('D75')
#logging.debug(slogm('Polkit applier for machine will not be started'))
class polkit_applier_user(applier_frontend):
__module_name = 'PolkitApplierUser'
@ -93,12 +89,10 @@ class polkit_applier_user(applier_frontend):
logdata['user'] = self.username
logdata['Deny_All'] = deny_all.data
log('D70', logdata)
#logging.debug(slogm('Deny_All setting for user {} found: {}'.format(self.username, deny_all.data)))
self.__polkit_map[self.__deny_all][1]['Deny_All'] = deny_all.data
self.__polkit_map[self.__deny_all][1]['User'] = self.username
else:
log('D72')
#logging.debug(slogm('Deny_All setting not found'))
self.policies = []
self.policies.append(polkit(template_file, template_vars, self.username))
self.__module_enabled = check_enabled(
@ -116,10 +110,9 @@ class polkit_applier_user(applier_frontend):
'''
if self.__module_enabled:
log('D74')
#logging.debug(slogm('Running Polkit applier for user in administrator context'))
for policy in self.policies:
policy.generate()
else:
log('D76')
#logging.debug(slogm('Polkit applier for user in administrator context will not be started'))

View File

@ -49,13 +49,11 @@ class systemd_applier(applier_frontend):
logdata = dict()
logdata['unit'] = format(valuename)
log('I4', logdata)
#logging.info(slogm('Working with systemd unit {}'.format(valuename)))
except Exception as exc:
logdata = dict()
logdata['unit'] = format(valuename)
logdata['exc'] = exc
log('I5', logdata)
#logging.info(slogm('Unable to work with systemd unit {}: {}'.format(valuename, exc)))
for unit in self.units:
try:
unit.apply()
@ -63,7 +61,6 @@ class systemd_applier(applier_frontend):
logdata = dict()
logdata['unit'] = unit.unit_name
log('E45', logdata)
#logging.error(slogm('Failed applying unit {}'.format(unit.unit_name)))
def apply(self):
'''
@ -71,11 +68,9 @@ class systemd_applier(applier_frontend):
'''
if self.__module_enabled:
log('D78')
#logging.debug(slogm('Running systemd applier for machine'))
self.run()
else:
log('D79')
#logging.debug(slogm('systemd applier for machine will not be started'))
class systemd_applier_user(applier_frontend):
__module_name = 'SystemdApplierUser'