def trycmd(*args, **kwargs):
 discard_warnings = kwargs.pop('discard_warnings', False)
 try:
  (out, err) = execute(*args, **kwargs)
  failed = False
 except exception.ProcessExecutionError as exn:
  (out, err) = ('', str(exn))
  LOG.debug(err)
  failed = True
 if ((not failed) and discard_warnings and err):
  LOG.debug(err)
  err = ''
 return (out, err)

def trycmd ( * args , ** kwargs ) : discard_warnings = kwargs . pop ( 'discard_warnings' , False ) try : ( out , err ) = execute ( * args , ** kwargs ) failed = False except exception . ProcessExecutionError as exn : ( out , err ) = ( '' , str ( exn ) ) LOG . debug ( err ) failed = True if ( ( not failed ) and discard_warnings and err ) : LOG . debug ( err ) err = '' return ( out , err )
a wrapper around execute() to more easily handle warnings and errors .