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
fe32b72f
Verified
Commit
fe32b72f
authored
10 months ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Have LibreNMS client perform multiple retires when a connection times out
parent
35d11e8e
No related branches found
No related tags found
No related merge requests found
Pipeline
#88380
failed
10 months ago
Stage: tox
Stage: documentation
Stage: sonarqube
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/services/librenms_client.py
+4
-2
4 additions, 2 deletions
gso/services/librenms_client.py
with
4 additions
and
2 deletions
gso/services/librenms_client.py
+
4
−
2
View file @
fe32b72f
...
...
@@ -7,6 +7,7 @@ from typing import Any, Literal
import
requests
from
requests
import
HTTPError
,
Response
from
requests.adapters
import
HTTPAdapter
from
gso.settings
import
load_oss_params
from
gso.utils.helpers
import
SNMPVersion
...
...
@@ -26,6 +27,7 @@ class LibreNMSClient:
self
.
snmp_config
=
config
.
SNMP
self
.
session
=
requests
.
Session
()
self
.
session
.
mount
(
"
https://
"
,
HTTPAdapter
(
max_retries
=
5
))
self
.
session
.
headers
.
update
({
"
User-Agent
"
:
f
"
geant-service-orchestrator/
{
metadata
.
version
(
"
geant-service-orchestrator
"
)
}
"
,
"
Accept
"
:
"
application/json
"
,
...
...
@@ -34,11 +36,11 @@ class LibreNMSClient:
})
def
_send_request
(
self
,
method
:
Literal
[
"
GET
"
,
"
POST
"
,
"
PUT
"
,
"
DELETE
"
],
endpoint
:
str
,
data
:
dict
[
str
,
Any
]
|
None
=
None
self
,
method
:
Literal
[
"
GET
"
,
"
POST
"
,
"
PUT
"
,
"
DELETE
"
],
endpoint
:
str
,
data
:
dict
[
str
,
Any
]
|
None
=
None
)
->
Response
:
url
=
self
.
base_url
+
endpoint
logger
.
debug
(
"
LibreNMS - Sending request
"
,
extra
=
{
"
method
"
:
method
,
"
endpoint
"
:
url
,
"
form_data
"
:
data
})
result
=
self
.
session
.
request
(
method
,
url
,
json
=
data
)
result
=
self
.
session
.
request
(
method
,
url
,
json
=
data
,
timeout
=
(
0.5
,
75
)
)
logger
.
debug
(
"
LibreNMS - Received response
"
,
extra
=
result
.
__dict__
)
return
result
...
...
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