2020-07-10 00:58:55 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import salt.utils.dictupdate
|
|
|
|
import salt.utils.dictdiffer
|
|
|
|
|
2021-01-17 17:43:56 +01:00
|
|
|
|
2023-03-31 17:38:52 +02:00
|
|
|
def jobs(name, url="http://localhost:8080", verify=False, jobs={}, default_job={}):
|
2020-07-10 00:58:55 +02:00
|
|
|
ret = {'name': name,
|
2020-09-30 00:44:06 +02:00
|
|
|
'changes': {},
|
|
|
|
'result': True,
|
|
|
|
'comment': 'Config is up to date'}
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2023-03-31 17:38:52 +02:00
|
|
|
for name, j in jobs.items():
|
|
|
|
j['name'] = name
|
|
|
|
job = default_job.copy()
|
|
|
|
job.update(j)
|
|
|
|
res = __salt__['dkron.set_job'](url, job)
|
2020-07-10 00:58:55 +02:00
|
|
|
if res is not None:
|
|
|
|
ret['changes'][job['name']] = res
|
|
|
|
else:
|
|
|
|
ret['result'] = False
|
|
|
|
ret['comment'] = "Error occured"
|
|
|
|
|
|
|
|
return ret
|