

def build_schedule_item(name, **kwargs):
    "\n    Build a schedule job\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' schedule.build_schedule_item job1 function='test.ping' seconds=3600\n    "
    ret = {
        'comment': [],
        'result': True,
    }
    if (not name):
        ret['comment'] = 'Job name is required.'
        ret['result'] = False
        return ret
    schedule = {
        
    }
    schedule[name] = salt.utils.odict.OrderedDict()
    schedule[name]['function'] = kwargs['function']
    time_conflict = False
    for item in ['seconds', 'minutes', 'hours', 'days']:
        if ((item in kwargs) and ('when' in kwargs)):
            time_conflict = True
        if ((item in kwargs) and ('cron' in kwargs)):
            time_conflict = True
    if time_conflict:
        ret['result'] = False
        ret['comment'] = 'Unable to use "seconds", "minutes", "hours", or "days" with "when" or "cron" options.'
        return ret
    if (('when' in kwargs) and ('cron' in kwargs)):
        ret['result'] = False
        ret['comment'] = 'Unable to use "when" and "cron" options together.  Ignoring.'
        return ret
    for item in ['seconds', 'minutes', 'hours', 'days']:
        if (item in kwargs):
            schedule[name][item] = kwargs[item]
    if ('return_job' in kwargs):
        schedule[name]['return_job'] = kwargs['return_job']
    if ('metadata' in kwargs):
        schedule[name]['metadata'] = kwargs['metadata']
    if ('job_args' in kwargs):
        schedule[name]['args'] = kwargs['job_args']
    if ('job_kwargs' in kwargs):
        schedule[name]['kwargs'] = kwargs['job_kwargs']
    if ('maxrunning' in kwargs):
        schedule[name]['maxrunning'] = kwargs['maxrunning']
    else:
        schedule[name]['maxrunning'] = 1
    if ('name' in kwargs):
        schedule[name]['name'] = kwargs['name']
    else:
        schedule[name]['name'] = name
    if ('enabled' in kwargs):
        schedule[name]['enabled'] = kwargs['enabled']
    else:
        schedule[name]['enabled'] = True
    if (('jid_include' not in kwargs) or kwargs['jid_include']):
        schedule[name]['jid_include'] = True
    if ('splay' in kwargs):
        if isinstance(kwargs['splay'], dict):
            schedule[name]['splay'] = salt.utils.odict.OrderedDict()
            schedule[name]['splay']['start'] = kwargs['splay']['start']
            schedule[name]['splay']['end'] = kwargs['splay']['end']
        else:
            schedule[name]['splay'] = kwargs['splay']
    for item in ['range', 'when', 'once', 'once_fmt', 'cron', 'returner', 'return_config', 'return_kwargs', 'until', 'enabled']:
        if (item in kwargs):
            schedule[name][item] = kwargs[item]
    if ('enabled' not in kwargs):
        schedule[name]['enabled'] = True
    return schedule[name]

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