Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FoD
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
Show more breadcrumbs
David Schmitz
FoD
Commits
f47e44c6
Commit
f47e44c6
authored
3 years ago
by
David Schmitz
Browse files
Options
Downloads
Patches
Plain Diff
logging cleanup
parent
d9aa63ed
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flowspec/tasks.py
+6
-2
6 additions, 2 deletions
flowspec/tasks.py
with
6 additions
and
2 deletions
flowspec/tasks.py
+
6
−
2
View file @
f47e44c6
...
@@ -99,18 +99,19 @@ def deactivate_route(routepk, **kwargs):
...
@@ -99,18 +99,19 @@ def deactivate_route(routepk, **kwargs):
if
initial_status
not
in
(
"
ACTIVE
"
,
"
PENDING
"
,
"
ERROR
"
):
if
initial_status
not
in
(
"
ACTIVE
"
,
"
PENDING
"
,
"
ERROR
"
):
logger
.
error
(
"
tasks::deactivate(): Cannot deactivate route that is not in ACTIVE or potential ACTIVE status.
"
)
logger
.
error
(
"
tasks::deactivate(): Cannot deactivate route that is not in ACTIVE or potential ACTIVE status.
"
)
return
return
logger
.
info
(
"
tasks::deactivate_route(): initial_status=
"
+
str
(
initial_status
))
applier
=
PR
.
Applier
(
route_object
=
route
)
applier
=
PR
.
Applier
(
route_object
=
route
)
# Delete from router via NETCONF
# Delete from router via NETCONF
commit
,
response
=
applier
.
apply
(
operation
=
"
delete
"
)
commit
,
response
=
applier
.
apply
(
operation
=
"
delete
"
)
reason_text
=
''
reason_text
=
''
logger
.
info
(
"
tasks::de
lete(): initial_status=
"
+
str
(
initial_status
))
logger
.
info
(
"
tasks::de
activate_route(): commit=
"
+
str
(
commit
))
if
commit
:
if
commit
:
route
.
status
=
"
INACTIVE
"
route
.
status
=
"
INACTIVE
"
try
:
try
:
snmp_add_initial_zero_value
(
str
(
route
.
id
),
False
)
snmp_add_initial_zero_value
(
str
(
route
.
id
),
False
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
"
edit
(): route=
"
+
str
(
route
)
+
"
, INACTIVE, add_null_value failed:
"
+
str
(
e
))
logger
.
error
(
"
tasks::deactivate_route
(): route=
"
+
str
(
route
)
+
"
, INACTIVE, add_null_value failed:
"
+
str
(
e
))
announce
(
"
[%s] Suspending rule : %s%s- Result %s
"
%
(
route
.
applier_username_nice
,
route
.
name
,
reason_text
,
response
),
route
.
applier
,
route
)
announce
(
"
[%s] Suspending rule : %s%s- Result %s
"
%
(
route
.
applier_username_nice
,
route
.
name
,
reason_text
,
response
),
route
.
applier
,
route
)
route
.
status
=
"
INACTIVE
"
route
.
status
=
"
INACTIVE
"
...
@@ -146,6 +147,9 @@ def delete_route(routepk, **kwargs):
...
@@ -146,6 +147,9 @@ def delete_route(routepk, **kwargs):
deactivate_route
(
routepk
)
deactivate_route
(
routepk
)
except
TimeoutError
:
except
TimeoutError
:
pass
pass
except
Exception
as
e
:
logger
.
info
(
"
tasks::delete_route(): exception during deactivate_route:
"
+
str
(
e
))
logger
.
info
(
"
tasks::delete_route(): deactivate_route done => route.status=
"
+
str
(
route
.
status
))
if
route
.
status
!=
"
INACTIVE
"
and
delete_route
.
request
.
retries
<
settings
.
NETCONF_MAX_RETRY_BEFORE_ERROR
:
if
route
.
status
!=
"
INACTIVE
"
and
delete_route
.
request
.
retries
<
settings
.
NETCONF_MAX_RETRY_BEFORE_ERROR
:
# Repeat due to error in deactivation
# Repeat due to error in deactivation
route
.
status
=
"
PENDING
"
route
.
status
=
"
PENDING
"
...
...
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