def run_operation(jboss_config, operation, fail_on_error=True, retries=1):
 cli_command_result = __call_cli(jboss_config, operation, retries)
 if (cli_command_result['retcode'] == 0):
  if _is_cli_output(cli_command_result['stdout']):
   cli_result = _parse(cli_command_result['stdout'])
   cli_result['success'] = (cli_result['outcome'] == 'success')
  else:
   raise CommandExecutionError('Operation has returned unparseable output: {0}'.format(cli_command_result['stdout']))
 elif _is_cli_output(cli_command_result['stdout']):
  cli_result = _parse(cli_command_result['stdout'])
  cli_result['success'] = False
  match = re.search('^(JBAS\\d+):', cli_result['failure-description'])
  cli_result['err_code'] = match.group(1)
  cli_result['stdout'] = cli_command_result['stdout']
 elif fail_on_error:
  raise CommandExecutionError("Command execution failed, return code={retcode}, stdout='{stdout}', stderr='{stderr}' ".format(**cli_command_result))
 else:
  cli_result = {'success': False, 'stdout': cli_command_result['stdout'], 'stderr': cli_command_result['stderr'], 'retcode': cli_command_result['retcode']}
 return cli_result

def run_operation ( jboss_config , operation , fail_on_error = True , retries = 1 ) : cli_command_result = __call_cli ( jboss_config , operation , retries ) if ( cli_command_result [ 'retcode' ] == 0 ) : if _is_cli_output ( cli_command_result [ 'stdout' ] ) : cli_result = _parse ( cli_command_result [ 'stdout' ] ) cli_result [ 'success' ] = ( cli_result [ 'outcome' ] == 'success' ) else : raise CommandExecutionError ( 'Operation has returned unparseable output: {0}' . format ( cli_command_result [ 'stdout' ] ) ) elif _is_cli_output ( cli_command_result [ 'stdout' ] ) : cli_result = _parse ( cli_command_result [ 'stdout' ] ) cli_result [ 'success' ] = False match = re . search ( '^(JBAS\\d+):' , cli_result [ 'failure-description' ] ) cli_result [ 'err_code' ] = match . group ( 1 ) cli_result [ 'stdout' ] = cli_command_result [ 'stdout' ] elif fail_on_error : raise CommandExecutionError ( "Command execution failed, return code={retcode}, stdout='{stdout}', stderr='{stderr}' " . format ( ** cli_command_result ) ) else : cli_result = { 'success' : False , 'stdout' : cli_command_result [ 'stdout' ] , 'stderr' : cli_command_result [ 'stderr' ] , 'retcode' : cli_command_result [ 'retcode' ] } return cli_result
execute an operation against jboss instance through the cli interface .