

def purge(**kwargs):
    "\n    Purge all the jobs currently scheduled on the minion\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' schedule.purge\n    "
    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
                        return ret
            except KeyError:
                ret['comment'] = 'Event module not available. Schedule add failed.'
                ret['result'] = True
    return ret

dataset/ETHPy150Open saltstack/salt/salt/modules/schedule.py purge/original