示例#1
0
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)
示例#2
0
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)
示例#3
0
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