1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-01-05 05:17:52 +03:00

Added prevention of unnecessary startup of the gpupdate.service

This commit is contained in:
Valery Sinelnikov 2024-12-05 17:05:42 +04:00
parent 99a6e85ccf
commit aa4bf9a7c8
2 changed files with 6 additions and 4 deletions

View File

@ -37,6 +37,9 @@ class systemd_unit:
if self.desired_state == 1:
self.manager.UnmaskUnitFiles([self.unit_name], dbus.Boolean(False))
self.manager.EnableUnitFiles([self.unit_name], dbus.Boolean(False), dbus.Boolean(True))
if self.unit_name == 'gpupdate.service':
if self.manager.GetUnitFileState(dbus.String(self.unit_name)) == 'enabled':
return
self.manager.StartUnit(self.unit_name, 'replace')
logdata = dict()
logdata['unit'] = self.unit_name

View File

@ -42,15 +42,14 @@ class systemd_applier(applier_frontend):
def run(self):
for setting in self.systemd_unit_settings:
valuename = setting.hive_key.rpartition('/')[2]
try:
self.units.append(systemd_unit(valuename, int(setting.data)))
self.units.append(systemd_unit(setting.valuename, int(setting.data)))
logdata = dict()
logdata['unit'] = format(valuename)
logdata['unit'] = format(setting.valuename)
log('I4', logdata)
except Exception as exc:
logdata = dict()
logdata['unit'] = format(valuename)
logdata['unit'] = format(setting.valuename)
logdata['exc'] = exc
log('I5', logdata)
for unit in self.units: