Ensure a job is disabled in the schedule

    name
        The unique name that is given to the scheduled job.

    persist
        Whether the job should persist between minion restarts, defaults to True.

def disabled(name, **kwargs):
    '''
    Ensure a job is disabled in the schedule

    name
        The unique name that is given to the scheduled job.

    persist
        Whether the job should persist between minion restarts, defaults to True.

    '''

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

    current_schedule = __salt__['schedule.list'](show_all=True, return_yaml=False)
    if name in current_schedule:
        if 'test' in __opts__ and __opts__['test']:
            kwargs['test'] = True
            result = __salt__['schedule.disable_job'](name, **kwargs)
            ret['comment'].append(result['comment'])
        else:
            result = __salt__['schedule.disable_job'](name, **kwargs)
            if not result['result']:
                ret['result'] = result['result']
                ret['comment'] = result['comment']
                return ret
            else:
                ret['comment'].append('Disabled job {0} from schedule'.format(name))
    else:
        ret['comment'].append('Job {0} not present in schedule'.format(name))

    ret['comment'] = '\n'.join(ret['comment'])
    return ret