forked from shaba/openuds
Reversed the order for change password on 3.5 UDS
This commit is contained in:
parent
564f0e17de
commit
59bd6c1649
@ -37,6 +37,7 @@ import typing
|
||||
class LocalLogger: # pylint: disable=too-few-public-methods
|
||||
linux = False
|
||||
windows = True
|
||||
serviceLogger = False
|
||||
|
||||
logger: typing.Optional[logging.Logger]
|
||||
|
||||
|
@ -366,17 +366,19 @@ class CommonService: # pylint: disable=too-many-instance-attributes
|
||||
'''
|
||||
hostName = platform.operations.getComputerName()
|
||||
|
||||
if hostName.lower() == name.lower():
|
||||
logger.info('Computer name is already {}'.format(hostName))
|
||||
return
|
||||
|
||||
# Check for password change request for an user
|
||||
if userName and newPassword:
|
||||
changed = True
|
||||
logger.info('Setting password for configured user')
|
||||
try:
|
||||
platform.operations.changeUserPassword(userName, oldPassword or '', newPassword)
|
||||
except Exception as e:
|
||||
raise Exception('Could not change password for user {} (maybe invalid current password is configured at broker): {} '.format(userName, str(e)))
|
||||
# Logs error, but continue renaming computer
|
||||
logger.error('Could not change password for user {}: {}'.format(userName, e))
|
||||
|
||||
if hostName.lower() == name.lower():
|
||||
logger.info('Computer name is already {}'.format(hostName))
|
||||
return
|
||||
|
||||
if platform.operations.renameComputer(name):
|
||||
self.reboot()
|
||||
|
@ -34,7 +34,8 @@ import os
|
||||
import tempfile
|
||||
import typing
|
||||
|
||||
import servicemanager # pylint: disable=import-error
|
||||
import servicemanager
|
||||
from udsactor import service # pylint: disable=import-error
|
||||
|
||||
# Valid logging levels, from UDS Broker (uds.core.utils.log).
|
||||
from .. import loglevel
|
||||
@ -42,6 +43,7 @@ from .. import loglevel
|
||||
class LocalLogger: # pylint: disable=too-few-public-methods
|
||||
linux = False
|
||||
windows = True
|
||||
serviceLogger = False
|
||||
|
||||
logger: typing.Optional[logging.Logger]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user