25 lines
635 B
Python
25 lines
635 B
Python
#!/usr/bin/python3
|
|
|
|
import salt.utils.dictupdate
|
|
import salt.utils.dictdiffer
|
|
|
|
|
|
def jobs(name, url="http://localhost:8080", verify=False, jobs={}, default_job={}):
|
|
ret = {'name': name,
|
|
'changes': {},
|
|
'result': True,
|
|
'comment': 'Config is up to date'}
|
|
|
|
for name, j in jobs.items():
|
|
j['name'] = name
|
|
job = default_job.copy()
|
|
job.update(j)
|
|
res = __salt__['dkron.set_job'](url, job)
|
|
if res is not None:
|
|
ret['changes'][job['name']] = res
|
|
else:
|
|
ret['result'] = False
|
|
ret['comment'] = "Error occured"
|
|
|
|
return ret
|