mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-01-10 17:17:37 +03:00
Fix startup user and computer gpoa initialization
This commit is contained in:
parent
306b8db34a
commit
57f4f0678a
37
gpoa/gpoa
37
gpoa/gpoa
@ -73,25 +73,44 @@ class gpoa_controller:
|
||||
def __init__(self):
|
||||
self.__args = parse_arguments()
|
||||
self.is_machine = False
|
||||
if not self.__args.user:
|
||||
user = get_machine_name()
|
||||
self.is_machine = True
|
||||
self.noupdate = self.__args.noupdate
|
||||
set_loglevel(self.__args.loglevel)
|
||||
|
||||
locale.bindtextdomain('gpoa', '/usr/lib/python3/site-packages/gpoa/locale')
|
||||
gettext.bindtextdomain('gpoa', '/usr/lib/python3/site-packages/gpoa/locale')
|
||||
gettext.textdomain('gpoa')
|
||||
|
||||
if not self.__args.user:
|
||||
self.username = get_machine_name()
|
||||
self.is_machine = True
|
||||
else:
|
||||
self.username = self.__args.user
|
||||
|
||||
uname = get_process_user()
|
||||
uid = os.getuid()
|
||||
logdata = dict()
|
||||
logdata['username'] = uname
|
||||
logdata['uid'] = uid
|
||||
log('D1', logdata)
|
||||
logdata['username'] = self.username
|
||||
logdata['is_machine'] = self.is_machine
|
||||
logdata['process_username'] = uname
|
||||
logdata['process_uid'] = uid
|
||||
|
||||
if self.is_machine:
|
||||
log('D61', logdata)
|
||||
else:
|
||||
log('D1', logdata)
|
||||
self.username = determine_username(self.username)
|
||||
|
||||
if not is_root():
|
||||
self.username = uname
|
||||
self.noupdate = True
|
||||
|
||||
if self.is_machine:
|
||||
msgtext = message_with_code('E34')
|
||||
log('E34', {'username': self.username})
|
||||
raise Exception(msgtext)
|
||||
|
||||
log('D59', {'username': self.username})
|
||||
else:
|
||||
self.username = determine_username(self.__args.user)
|
||||
log('D60', {'username': self.username})
|
||||
|
||||
def run(self):
|
||||
'''
|
||||
@ -113,7 +132,7 @@ class gpoa_controller:
|
||||
if self.__args.nodomain:
|
||||
nodomain = True
|
||||
|
||||
if not self.__args.noupdate:
|
||||
if not self.noupdate:
|
||||
if is_root():
|
||||
back = None
|
||||
try:
|
||||
|
@ -61,6 +61,7 @@ def error_code(code):
|
||||
error_ids[31] = 'Error connecting to DBus Session daemon'
|
||||
error_ids[32] = 'No reply from DBus Session'
|
||||
error_ids[33] = 'Error occured while running forked process with dropped privileges'
|
||||
error_ids[34] = 'Error running GPOA directly for computer'
|
||||
|
||||
return error_ids.get(code, 'Unknown error code')
|
||||
|
||||
@ -124,6 +125,9 @@ def debug_code(code):
|
||||
debug_ids[56] = 'Kill dbus-daemon and dconf-service in user context'
|
||||
debug_ids[57] = 'Found connection by org.freedesktop.DBus.GetConnectionUnixProcessID'
|
||||
debug_ids[58] = 'Connection search return org.freedesktop.DBus.Error.NameHasNoOwner'
|
||||
debug_ids[59] = 'Running GPOA without GPT update directly for user'
|
||||
debug_ids[60] = 'Running GPOA by root for user'
|
||||
debug_ids[61] = 'The GPOA process was started for computer'
|
||||
|
||||
return debug_ids.get(code, 'Unknown debug code')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user