Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
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
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
0e46f909
Verified
Commit
0e46f909
authored
7 months ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Improve error handling for missing LibreNMS device in router termination
parent
92bfe7cc
No related branches found
No related tags found
No related merge requests found
Pipeline
#89733
passed
7 months ago
Stage: tox
Stage: documentation
Stage: sonarqube
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/router/terminate_router.py
+10
-3
10 additions, 3 deletions
gso/workflows/router/terminate_router.py
with
10 additions
and
3 deletions
gso/workflows/router/terminate_router.py
+
10
−
3
View file @
0e46f909
...
@@ -8,6 +8,7 @@ from orchestrator.forms import FormPage
...
@@ -8,6 +8,7 @@ from orchestrator.forms import FormPage
from
orchestrator.forms.validators
import
Label
from
orchestrator.forms.validators
import
Label
from
orchestrator.targets
import
Target
from
orchestrator.targets
import
Target
from
orchestrator.types
import
FormGenerator
,
State
,
SubscriptionLifecycle
,
UUIDstr
from
orchestrator.types
import
FormGenerator
,
State
,
SubscriptionLifecycle
,
UUIDstr
from
orchestrator.utils.errors
import
ProcessFailureError
from
orchestrator.utils.json
import
json_dumps
from
orchestrator.utils.json
import
json_dumps
from
orchestrator.workflow
import
StepList
,
begin
,
conditional
,
done
,
step
,
workflow
from
orchestrator.workflow
import
StepList
,
begin
,
conditional
,
done
,
step
,
workflow
from
orchestrator.workflows.steps
import
(
from
orchestrator.workflows.steps
import
(
...
@@ -223,13 +224,19 @@ def remove_pe_from_all_p_real(subscription: Router, tt_number: str, process_id:
...
@@ -223,13 +224,19 @@ def remove_pe_from_all_p_real(subscription: Router, tt_number: str, process_id:
@step
(
"
Remove Device from Librenms
"
)
@step
(
"
Remove Device from Librenms
"
)
def
remove_device_from_librenms
(
subscription
:
Router
)
->
State
|
None
:
def
remove_device_from_librenms
(
subscription
:
Router
)
->
State
:
"""
Remove the device from LibreNMS.
"""
"""
Remove the device from LibreNMS.
"""
try
:
try
:
LibreNMSClient
().
remove_device
(
subscription
.
router
.
router_fqdn
)
LibreNMSClient
().
remove_device
(
subscription
.
router
.
router_fqdn
)
except
HTTPError
as
e
:
except
HTTPError
as
e
:
return
{
"
librenms_error
"
:
str
(
e
)}
response
=
e
.
response
.
json
()
return
None
if
response
[
"
message
"
]
==
f
"
Device
{
subscription
.
router
.
router_fqdn
}
not found
"
:
return
{
"
librenms_error
"
:
str
(
e
.
response
.
json
()),
"
librenms_device
"
:
"
Device not found, please confirm nothing needs to be removed from LibreNMS
"
,
}
raise
ProcessFailureError
(
message
=
"
LibreNMS error
"
,
details
=
response
)
from
None
return
{
"
librenms_device
"
:
"
Device removed from LibreNMS
"
}
@step
(
"
Apply the archiving license in Kentik
"
)
@step
(
"
Apply the archiving license in Kentik
"
)
...
...
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