ovirt_job: add when job is detected but in state finished (#66810)

* ovirt_job: add when job is detected but in state finished

* add docs
This commit is contained in:
Martin Nečas 2020-02-03 15:21:10 +01:00 committed by GitHub
parent 53c7f8cbde
commit fad261b04f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,6 +36,7 @@ options:
description: description:
description: description:
- "Description of the job." - "Description of the job."
- "When task with same description has already finished and you rerun taks it will create new job."
required: true required: true
state: state:
description: description:
@ -199,7 +200,7 @@ def main():
job = get_entity(jobs_service, module.params['description']) job = get_entity(jobs_service, module.params['description'])
changed = False changed = False
if state in ['present', 'started']: if state in ['present', 'started']:
if job is None: if job is None or job.status in [otypes.JobStatus.FINISHED, otypes.JobStatus.FAILED]:
job = jobs_service.add(build_job(module.params['description'])) job = jobs_service.add(build_job(module.params['description']))
changed = True changed = True
changed = attach_steps(module, job.id, jobs_service) or changed changed = attach_steps(module, job.id, jobs_service) or changed