2020-07-10 00:58:55 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
import salt.utils.dictupdate
|
|
|
|
import salt.utils.dictdiffer
|
|
|
|
|
2020-09-30 00:44:06 +02:00
|
|
|
def jobs(name, url="http://localhost:8080", verify=False, job_list=[]):
|
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
|
|
|
|
|
|
|
#dk_jobs = []
|
|
|
|
#dk_jobs = __salt__['dkron.get_jobs'](url, verify)
|
|
|
|
|
2020-09-30 00:44:06 +02:00
|
|
|
for job in job_list:
|
2020-07-10 00:58:55 +02:00
|
|
|
res = __salt__['dkron.set_jobs'](url, verify, job)
|
|
|
|
if res is not None:
|
|
|
|
ret['changes'][job['name']] = res
|
|
|
|
else:
|
|
|
|
ret['result'] = False
|
|
|
|
ret['comment'] = "Error occured"
|
|
|
|
|
|
|
|
return ret
|