mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix undeclared result for nomad_job_info module (#1721)
* Fix unassigned variable * Create 1721-fix-nomad_job_info-no-jobs-failure.yml * refactor usage of variables in nomad_job_info * Update changelogs/fragments/1721-fix-nomad_job_info-no-jobs-failure.yml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
bd372939bc
commit
d09a558fda
2 changed files with 4 additions and 3 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- nomad_job_info - fix module failure when nomad client returns no jobs (https://github.com/ansible-collections/community.general/pull/1721).
|
|
@ -312,12 +312,11 @@ def run():
|
||||||
)
|
)
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
nomad_jobs = list()
|
result = list()
|
||||||
try:
|
try:
|
||||||
job_list = nomad_client.jobs.get_jobs()
|
job_list = nomad_client.jobs.get_jobs()
|
||||||
for job in job_list:
|
for job in job_list:
|
||||||
nomad_jobs.append(nomad_client.job.get_job(job.get('ID')))
|
result.append(nomad_client.job.get_job(job.get('ID')))
|
||||||
result = nomad_jobs
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=to_native(e))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue