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
ffbccc7f
Commit
ffbccc7f
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
add redundant key, change handling of Nokia config diff
parent
29003b99
No related branches found
No related tags found
1 merge request
!42
less verbose Nokia output
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lso/playbook.py
+12
-0
12 additions, 0 deletions
lso/playbook.py
with
12 additions
and
0 deletions
lso/playbook.py
+
12
−
0
View file @
ffbccc7f
...
@@ -7,6 +7,7 @@ import uuid
...
@@ -7,6 +7,7 @@ import uuid
import
ansible_runner
import
ansible_runner
import
requests
import
requests
import
xmltodict
from
pydantic
import
BaseModel
,
HttpUrl
from
pydantic
import
BaseModel
,
HttpUrl
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -89,6 +90,7 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
...
@@ -89,6 +90,7 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
"
invocation
"
,
"
invocation
"
,
"
include
"
,
"
include
"
,
"
include_args
"
,
"
include_args
"
,
"
server_capabilities
"
,
]
]
for
line
in
json_content
.
strip
().
splitlines
():
for
line
in
json_content
.
strip
().
splitlines
():
try
:
try
:
...
@@ -110,8 +112,18 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
...
@@ -110,8 +112,18 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
continue
continue
if
"
diff_lines
"
in
task_result
:
if
"
diff_lines
"
in
task_result
:
# Juniper-specific
# Prevent the diff from being displayed twice, and only keep the formatted version.
# Prevent the diff from being displayed twice, and only keep the formatted version.
task_result
.
pop
(
"
diff
"
,
None
)
task_result
.
pop
(
"
diff
"
,
None
)
elif
"
before
"
in
task_result
[
"
diff
"
]
and
"
after
"
in
task_result
[
"
diff
"
]:
# Nokia-specific
# We have a chunk of Nokia config, and we would like to show the actual diff, not a full before and
# after. This will take some extra steps.
before_parsed
=
xmltodict
.
parse
(
task_result
[
"
diff
"
][
"
before
"
])
after_parsed
=
xmltodict
.
parse
(
task_result
[
"
diff
"
][
"
after
"
])
# Only leave the diff in the resulting output
task_result
[
"
diff
"
]
=
{
k
:
v
for
k
,
v
in
after_parsed
.
items
()
if
k
not
in
before_parsed
or
v
!=
before_parsed
[
k
]}
if
bool
(
task_result
):
if
bool
(
task_result
):
# Only add the event if there are any relevant keys left.
# Only add the event if there are any relevant keys left.
...
...
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