def testExecutingWithShellWorks(): """ 'shell' must be an accepted keyword. This is to have the same keywords and behaviours on Windows and Linux. """ Posix.execute('echo bla', shell=True)
def testExecutingWithWaitForEndingWorks(): """ waitForEnding must be an accepted keyword. This is to have the same keywords and behaviours on Windows and Linux. """ Posix.execute('echo bla', waitForEnding=True)
def readWindowsDomainFromUCR(): """ Get the Windows domain from Univention Config registry If no domain can be found this returns an empty string. :return: The Windows domain in uppercase letters. :rtype: str """ domain = '' try: readCommand = u'{ucr} get windows/domain'.format( ucr=Posix.which('ucr')) for output in Posix.execute(readCommand): if output: domain = output.strip().upper() break except Posix.CommandNotFoundException as missingCommandError: LOGGER.info('Could not find ucr: {0}', missingCommandError) return domain