def raw_command(cmd, capture=False, env=None, data=None, cwd=None, explain=False, stdin=None, stdout=None):
 if (not cwd):
  cwd = os.getcwd()
 if (not env):
  env = common_environment()
 cmd = list(cmd)
 escaped_cmd = ' '.join((pipes.quote(c) for c in cmd))
 display.info(('Run command: %s' % escaped_cmd), verbosity=1)
 display.info(('Working directory: %s' % cwd), verbosity=2)
 program = find_executable(cmd[0], cwd=cwd, path=env['PATH'], required='warning')
 if program:
  display.info(('Program found: %s' % program), verbosity=2)
 for key in sorted(env.keys()):
  display.info(('%s=%s' % (key, env[key])), verbosity=2)
 if explain:
  return (None, None)
 communicate = False
 if (stdin is not None):
  data = None
  communicate = True
 elif (data is not None):
  stdin = subprocess.PIPE
  communicate = True
 if stdout:
  communicate = True
 if capture:
  stdout = (stdout or subprocess.PIPE)
  stderr = subprocess.PIPE
  communicate = True
 else:
  stderr = None
 start = time.time()
 try:
  process = subprocess.Popen(cmd, env=env, stdin=stdin, stdout=stdout, stderr=stderr, cwd=cwd)
 except OSError as ex:
  if (ex.errno == errno.ENOENT):
   raise ApplicationError(('Required program "%s" not found.' % cmd[0]))
  raise
 if communicate:
  (stdout, stderr) = process.communicate(data)
 else:
  process.wait()
  (stdout, stderr) = (None, None)
 status = process.returncode
 runtime = (time.time() - start)
 display.info(('Command exited with status %s after %s seconds.' % (status, runtime)), verbosity=4)
 if (status == 0):
  return (stdout, stderr)
 raise SubprocessError(cmd, status, stdout, stderr, runtime)

def raw_command ( cmd , capture = False , env = None , data = None , cwd = None , explain = False , stdin = None , stdout = None ) : if ( not cwd ) : cwd = os . getcwd ( ) if ( not env ) : env = common_environment ( ) cmd = list ( cmd ) escaped_cmd = ' ' . join ( ( pipes . quote ( c ) for c in cmd ) ) display . info ( ( 'Run command: %s' % escaped_cmd ) , verbosity = 1 ) display . info ( ( 'Working directory: %s' % cwd ) , verbosity = 2 ) program = find_executable ( cmd [ 0 ] , cwd = cwd , path = env [ 'PATH' ] , required = 'warning' ) if program : display . info ( ( 'Program found: %s' % program ) , verbosity = 2 ) for key in sorted ( env . keys ( ) ) : display . info ( ( '%s=%s' % ( key , env [ key ] ) ) , verbosity = 2 ) if explain : return ( None , None ) communicate = False if ( stdin is not None ) : data = None communicate = True elif ( data is not None ) : stdin = subprocess . PIPE communicate = True if stdout : communicate = True if capture : stdout = ( stdout or subprocess . PIPE ) stderr = subprocess . PIPE communicate = True else : stderr = None start = time . time ( ) try : process = subprocess . Popen ( cmd , env = env , stdin = stdin , stdout = stdout , stderr = stderr , cwd = cwd ) except OSError as ex : if ( ex . errno == errno . ENOENT ) : raise ApplicationError ( ( 'Required program "%s" not found.' % cmd [ 0 ] ) ) raise if communicate : ( stdout , stderr ) = process . communicate ( data ) else : process . wait ( ) ( stdout , stderr ) = ( None , None ) status = process . returncode runtime = ( time . time ( ) - start ) display . info ( ( 'Command exited with status %s after %s seconds.' % ( status , runtime ) ) , verbosity = 4 ) if ( status == 0 ) : return ( stdout , stderr ) raise SubprocessError ( cmd , status , stdout , stderr , runtime )
send raw ipmi command this allows arbitrary ipmi bytes to be issued .