def multiStepJoin(self, name, domain, ou, account, password): 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.info( 'Machine {} is part of domain {}'.format(name, domain)) self.setReady() else: operations.joinDomain( domain, ou, account, password, executeInOneStep=False) else: operations.renameComputer(name) logger.info( 'Rebooting computer got activate new name {}'.format(name)) self.reboot()
def oneStepJoin(self, name, domain, ou, account, password): ''' Ejecutes the join domain in exactly one step ''' currName = operations.getComputerName() # If name is desired, simply execute multiStepJoin, because computer # name will not change if currName.lower() == name.lower(): self.multiStepJoin(name, domain, ou, account, password) else: operations.renameComputer(name) logger.debug('Computer renamed to {} without reboot'.format(name)) operations.joinDomain( domain, ou, account, password, executeInOneStep=True) logger.debug( 'Requested join domain {} without errors'.format(domain)) self.reboot()
def multiStepJoin(self, name, domain, ou, account, password): currName = operations.getComputerName() if currName.lower() == name.lower(): currDomain = operations.getDomainName() 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() else: operations.joinDomain( domain, ou, account, password, executeInOneStep=False) self.reboot() else: operations.renameComputer(name) logger.info( 'Rebooting computer got activate new name {}'.format(name)) self.reboot()