From 83efb819663a5672a6c5f1914056c21baf8243dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Tue, 20 Oct 2015 19:42:14 +0200 Subject: [PATCH] Fixed Windows domain --- actors/src/udsactor/service.py | 4 ++-- actors/src/udsactor/windows/UDSActorService.py | 4 ++-- actors/src/udsactor/windows/operations.py | 4 ++-- .../src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/actors/src/udsactor/service.py b/actors/src/udsactor/service.py index 166c45566..ef4f7a15a 100644 --- a/actors/src/udsactor/service.py +++ b/actors/src/udsactor/service.py @@ -177,9 +177,9 @@ class CommonService(object): except REST.UserServiceNotFoundError: logger.error('The host has lost the sync state with broker! (host uuid changed?)') return False - except Exception as e: + except Exception as err: if counter % 60 == 0: - logger.warn('Too many retries in progress, though still trying (last error: {})'.format(exceptionToMessage(e))) + logger.warn('Too many retries in progress, though still trying (last error: {})'.format(exceptionToMessage(err))) counter += 1 # Any other error is expectable and recoverable, so let's wait # a bit and retry again diff --git a/actors/src/udsactor/windows/UDSActorService.py b/actors/src/udsactor/windows/UDSActorService.py index 104923daf..10e325470 100644 --- a/actors/src/udsactor/windows/UDSActorService.py +++ b/actors/src/udsactor/windows/UDSActorService.py @@ -138,8 +138,8 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService): currName = operations.getComputerName() if currName.lower() == name.lower(): currDomain = operations.getDomainName() - logger.debug('Name: "{}" vs "{}", Domain: "{}" vs "{}"'.format(currName.lower(), name.lower(), currDomain.lower(), domain.lower())) if currDomain is not None: + # logger.debug('Name: "{}" vs "{}", Domain: "{}" vs "{}"'.format(currName.lower(), name.lower(), currDomain.lower(), domain.lower())) logger.info( 'Machine {} is part of domain {}'.format(name, domain)) self.setReady() @@ -155,7 +155,7 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService): def joinDomain(self, name, domain, ou, account, password): ver = operations.getWindowsVersion() ver = ver[0] * 10 + ver[1] - logger.info('Starting joining domain {} with name {} (detected operating version: {})'.format( + logger.debug('Starting joining domain {} with name {} (detected operating version: {})'.format( domain, name, ver)) # Accepts one step joinDomain, also remember XP is no more supported by # microsoft, but this also must works with it because will do a "multi diff --git a/actors/src/udsactor/windows/operations.py b/actors/src/udsactor/windows/operations.py index 8701a22a4..f9fe85d92 100644 --- a/actors/src/udsactor/windows/operations.py +++ b/actors/src/udsactor/windows/operations.py @@ -172,8 +172,8 @@ def joinDomain(domain, ou, account, password, executeInOneStep=False): error = getErrorMessage(res) if res == 1355: error = "DC Is not reachable" - print res, error - raise Exception('Error joining domain {}, with credentials {}/*****{}: {}, {}'.format(domain.value, account.value, ', under OU {}'.format(ou.value) if ou.value is not None else '', res, error)) + logger.error('Error joining domain: {}, {}'.format(error, res)) + raise Exception('Error joining domain {}, with credentials {}/*****{}: {}, {}'.format(domain, account, ', under OU {}'.format(ou) if ou is not None else '', res, error)) def changeUserPassword(user, oldPassword, newPassword): diff --git a/server/src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py b/server/src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py index 1c4a8bed8..ccee0f411 100644 --- a/server/src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py +++ b/server/src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py @@ -65,7 +65,7 @@ class WinDomainOsManager(WindowsOsManager): self._ou = self._ou.replace(' ', '') if self._domain != '' and self._ou != '': lpath = 'dc=' + ',dc='.join(self._domain.split('.')) - if self._ou.find(lpath) == -1: + if self._ou.lower().find(lpath) == -1: self._ou += ',' + lpath def __getLdapError(self, e):