Skip to content
Snippets Groups Projects
Commit 95f4e54c authored by Pino, Adrián's avatar Pino, Adrián
Browse files

Fix linting

parent 5b652059
No related branches found
No related tags found
1 merge request!38Nat 189 ansible return json
Pipeline #83751 passed
......@@ -10,6 +10,7 @@ docs/build
docs/source/_static/openapi.json
docs/vale/styles/*
!docs/vale/styles/Vocab/
venv/
# Ignore files generated by apidoc
docs/source/lso.rst
......
"""Module that gathers common API responses and data models."""
import json
import enum
import json
import logging
import threading
import uuid
......@@ -71,7 +71,7 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
playbook=playbook_path,
inventory=inventory,
extravars=extra_vars,
json_mode=True
json_mode=True,
)
# Process playbook JSON stdout
......@@ -83,8 +83,8 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
try:
task_output = json.loads(line)
parsed_output.append(task_output)
except json.JSONDecodeError as e:
pass # Skip empty line
except json.JSONDecodeError:
parsed_output.append({"invalid_json": line})
payload = [
{
......@@ -92,9 +92,9 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
"status": ansible_playbook_run.status,
"job_id": job_id,
"output": json.dumps(parsed_output, indent=4),
"return_code": int(ansible_playbook_run.rc)
"return_code": int(ansible_playbook_run.rc),
},
"confirm": "ACCEPTED"
"confirm": "ACCEPTED",
}
]
......
from typing import TextIO
from io import StringIO
TEST_CALLBACK_URL = "https://fqdn.abc.xyz/api/resume"
......@@ -8,6 +8,6 @@ def test_ansible_runner_run(**kwargs):
def __init__(self):
self.status = "success"
self.rc = 0
self.stdout = TextIO()
self.stdout = StringIO("some initial text data")
return Runner()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment