def _wrapper(orig, pre='', post='', err_=None, run_args=None, **kwargs):
 ret = ''
 cmd = _cmd(**kwargs)
 cmd_str = ' '.join([x for x in (pre, cmd, post, orig)])
 if (run_args and isinstance(run_args, dict)):
  res = __salt__['cmd.run_all'](cmd_str, **run_args)
 else:
  res = __salt__['cmd.run_all'](cmd_str)
 if isinstance(err_, dict):
  for (k, v) in six.itermitems(res):
   err_[k] = v
 if (('retcode' in res) and (res['retcode'] != 0)):
  msg = ' '.join([x for x in (res['stdout'], res['stderr']) if x])
  ret = 'Unable to run "{0}" with run_args="{1}". Error: {2}'.format(cmd_str, run_args, msg)
  log.error(ret)
 else:
  try:
   ret = res['stdout']
  except KeyError:
   log.error("cmd.run_all did not return a dictionary with a key named 'stdout'")
 return ret

def _wrapper ( orig , pre = '' , post = '' , err_ = None , run_args = None , ** kwargs ) : ret = '' cmd = _cmd ( ** kwargs ) cmd_str = ' ' . join ( [ x for x in ( pre , cmd , post , orig ) ] ) if ( run_args and isinstance ( run_args , dict ) ) : res = __salt__ [ 'cmd.run_all' ] ( cmd_str , ** run_args ) else : res = __salt__ [ 'cmd.run_all' ] ( cmd_str ) if isinstance ( err_ , dict ) : for ( k , v ) in six . itermitems ( res ) : err_ [ k ] = v if ( ( 'retcode' in res ) and ( res [ 'retcode' ] != 0 ) ) : msg = ' ' . join ( [ x for x in ( res [ 'stdout' ] , res [ 'stderr' ] ) if x ] ) ret = 'Unable to run "{0}" with run_args="{1}". Error: {2}' . format ( cmd_str , run_args , msg ) log . error ( ret ) else : try : ret = res [ 'stdout' ] except KeyError : log . error ( "cmd.run_all did not return a dictionary with a key named 'stdout'" ) return ret
helper function that wraps the execution of freebsd-update command .