Example #1
0
def execute(commandname, args):
    from logging import getLogger
    log = getLogger()
    debug = log.debug

    from infi.execute import execute as _execute
    debug(u'executing {} {}'.format(commandname, ' '.join(args)))
    subprocess = _execute([commandname] + args)
    debug('waiting for it')
    subprocess.wait()
    debug('returncode = %s', subprocess.get_returncode())
    debug('stdout = %s', subprocess.get_stdout())
    debug('stderr = %s', subprocess.get_stderr())
    if subprocess.get_returncode() != 0:
        raise chain(translate_mount_error(subprocess.get_returncode())())
Example #2
0
def execute(commandname, args):
    from logging import getLogger

    log = getLogger()
    debug = log.debug

    from infi.execute import execute as _execute

    debug("executing {} {}".format(commandname, " ".join(args)))
    subprocess = _execute([commandname] + args)
    debug("waiting for it")
    subprocess.wait()
    debug("returncode = %s", subprocess.get_returncode())
    debug("stdout = %s", subprocess.get_stdout())
    debug("stderr = %s", subprocess.get_stderr())
    if subprocess.get_returncode() != 0:
        raise chain(MountException(subprocess.get_returncode()))
Example #3
0
def execute(command):
    from logging import getLogger
    log = getLogger(__name__)
    debug = log.debug
    from infi.execute import execute as _execute
    debug('executing %s', command)
    try:
        subprocess = _execute(command.split())
    except:
        from infi.exceptools import chain
        raise chain(ServiceException)
    debug('waiting for it')
    subprocess.wait()
    debug('returncode = %s', subprocess.get_returncode())
    debug('stdout = %s', subprocess.get_stdout())
    debug('stderr = %s', subprocess.get_stderr())
    if subprocess.get_returncode() != 0:
        raise ServiceException(subprocess.get_stderr())