def requeue(queue_id):
 ret = {'message': '', 'result': True}
 if (not queue_id):
  log.error('Required argument queue_id')
 if (not (queue_id == 'ALL')):
  queue = show_queue()
  _message = None
  for item in queue:
   if (item['queue_id'] == queue_id):
    _message = item
  if (not _message):
   ret['message'] = 'No message in queue with ID {0}'.format(queue_id)
   ret['result'] = False
   return ret
 cmd = 'postsuper -r {0}'.format(queue_id)
 result = __salt__['cmd.run_all'](cmd)
 if (result['retcode'] == 0):
  if (queue_id == 'ALL'):
   ret['message'] = 'Successfully requeued all messages'
  else:
   ret['message'] = 'Successfully requeued message with queue id {0}'.format(queue_id)
 elif (queue_id == 'ALL'):
  ret['message'] = 'Unable to requeue all messages'
 else:
  ret['message'] = 'Unable to requeue message with queue id {0}: {1}'.format(queue_id, result['stderr'])
 return ret

def requeue ( queue_id ) : ret = { 'message' : '' , 'result' : True } if ( not queue_id ) : log . error ( 'Required argument queue_id' ) if ( not ( queue_id == 'ALL' ) ) : queue = show_queue ( ) _message = None for item in queue : if ( item [ 'queue_id' ] == queue_id ) : _message = item if ( not _message ) : ret [ 'message' ] = 'No message in queue with ID {0}' . format ( queue_id ) ret [ 'result' ] = False return ret cmd = 'postsuper -r {0}' . format ( queue_id ) result = __salt__ [ 'cmd.run_all' ] ( cmd ) if ( result [ 'retcode' ] == 0 ) : if ( queue_id == 'ALL' ) : ret [ 'message' ] = 'Successfully requeued all messages' else : ret [ 'message' ] = 'Successfully requeued message with queue id {0}' . format ( queue_id ) elif ( queue_id == 'ALL' ) : ret [ 'message' ] = 'Unable to requeue all messages' else : ret [ 'message' ] = 'Unable to requeue message with queue id {0}: {1}' . format ( queue_id , result [ 'stderr' ] ) return ret
returns the element at index after moving it to the beginning of the queue .