Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LSO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
LSO
Commits
95f4e54c
Commit
95f4e54c
authored
1 year ago
by
Pino, Adrián
Browse files
Options
Downloads
Patches
Plain Diff
Fix linting
parent
5b652059
No related branches found
No related tags found
1 merge request
!38
Nat 189 ansible return json
Pipeline
#83751
passed
1 year ago
Stage: tox
Stage: documentation
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
lso/playbook.py
+6
-6
6 additions, 6 deletions
lso/playbook.py
test/routes/__init__.py
+2
-2
2 additions, 2 deletions
test/routes/__init__.py
with
9 additions
and
8 deletions
.gitignore
+
1
−
0
View file @
95f4e54c
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
lso/playbook.py
+
6
−
6
View file @
95f4e54c
"""
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
:
pa
ss
# Skip empty
line
except
json
.
JSONDecodeError
:
pa
rsed_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
"
,
}
]
...
...
This diff is collapsed.
Click to expand it.
test/routes/__init__.py
+
2
−
2
View file @
95f4e54c
from
typing
import
Text
IO
from
io
import
String
IO
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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment