Purge all the jobs currently scheduled on the minion

    CLI Example:

    .. code-block:: bash

        salt '*' schedule.purge

def purge(**kwargs):
    '''
    Purge all the jobs currently scheduled on the minion

    CLI Example:

    .. code-block:: bash

        salt '*' schedule.purge
    '''

    ret = {'comment': [],
           'result': True}

    for name in list_(show_all=True, return_yaml=False):
        if name == 'enabled':
            continue
        if name.startswith('__'):
            continue

        if 'test' in kwargs and kwargs['test']:
            ret['result'] = True
            ret['comment'].append('Job: {0} would be deleted from schedule.'.format(name))
        else:

            persist = True
            if 'persist' in kwargs:
                persist = kwargs['persist']

            try:
                eventer = salt.utils.event.get_event('minion', opts=__opts__)
                res = __salt__['event.fire']({'name': name,
                                              'func': 'delete',
                                              'persist': persist}, 'manage_schedule')
                if res:
                    event_ret = eventer.get_event(tag='/salt/minion/minion_schedule_delete_complete', wait=30)
                    if event_ret and event_ret['complete']:
                        _schedule_ret = event_ret['schedule']
                        if name not in _schedule_ret:
                            ret['result'] = True
                            ret['comment'].append('Deleted job: {0} from schedule.'.format(name))
                        else:
                            ret['comment'].append('Failed to delete job {0} from schedule.'.format(name))
                            ret['result'] = True

            except KeyError:
                # Effectively a no-op, since we can't really return without an event system
                ret['comment'] = 'Event module not available. Schedule add failed.'
                ret['result'] = True
    return ret