1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-08 21:18:00 +03:00

Changing the function when the service is stopped

If the machine is non-persistent, it will be leave from the domain
when the service is stopped.
This commit is contained in:
Alexander Burmatov 2023-05-17 16:35:09 +03:00
parent 2d30362301
commit f3ba042140

View File

@ -82,6 +82,22 @@ class UDSActorSvc(daemon.Daemon, CommonService):
automatic_id_mapping
)
def finish(self) -> None:
try:
if self._cfg.config and self._cfg.config.os:
osData = self._cfg.config.os
if osData.action == 'rename_ad' and osData.isPersistent == 'n' :
operations.leaveDomain(
osData.ad or '',
osData.username or '',
osData.password or '',
osData.clientSoftware or '',
osData.serverSoftware or '',
)
except Exception as e:
logger.error(f'Got exception operating machine: {e}')
super().finish()
def run(self) -> None:
logger.debug('Running Daemon: {}'.format(self._isAlive))
set_proctitle('UDSActorDaemon')