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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Schmitz
FoD
Commits
0035dddb
Commit
0035dddb
authored
Apr 8, 2022
by
David Schmitz
Browse files
Options
Downloads
Patches
Plain Diff
add possibility to add a fixed prefix to rule names
parent
6e3f9fb3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
flowspec/tasks.py
+5
-5
5 additions, 5 deletions
flowspec/tasks.py
flowspec/views.py
+0
-1
0 additions, 1 deletion
flowspec/views.py
with
5 additions
and
6 deletions
flowspec/tasks.py
+
5
−
5
View file @
0035dddb
...
...
@@ -65,7 +65,7 @@ def add(routepk, callback=None):
route
.
status
=
"
ERROR
"
route
.
response
=
response
route
.
save
()
announce
(
"
[%s] Rule add: %s - Result: %s
"
%
(
route
.
applier_username_nice
,
route
.
name
,
response
),
route
.
applier
,
route
)
announce
(
"
[%s] Rule add: %s - Result: %s
"
%
(
route
.
applier_username_nice
,
route
.
name
_visible
,
response
),
route
.
applier
,
route
)
@shared_task
(
ignore_result
=
True
,
autoretry_for
=
(
TimeLimitExceeded
,
SoftTimeLimitExceeded
),
retry_backoff
=
True
,
retry_kwargs
=
{
'
max_retries
'
:
settings
.
NETCONF_MAX_RETRY_BEFORE_ERROR
})
...
...
@@ -92,7 +92,7 @@ def edit(routepk, callback=None):
route
.
status
=
"
ERROR
"
route
.
response
=
response
route
.
save
()
announce
(
"
[%s] Rule edit: %s - Result: %s
"
%
(
route
.
applier_username_nice
,
route
.
name
,
response
),
route
.
applier
,
route
)
announce
(
"
[%s] Rule edit: %s - Result: %s
"
%
(
route
.
applier_username_nice
,
route
.
name
_visible
,
response
),
route
.
applier
,
route
)
@shared_task
(
ignore_result
=
True
,
autoretry_for
=
(
TimeoutError
,
TimeLimitExceeded
,
SoftTimeLimitExceeded
),
retry_backoff
=
True
,
retry_kwargs
=
{
'
max_retries
'
:
settings
.
NETCONF_MAX_RETRY_BEFORE_ERROR
})
def
deactivate_route
(
routepk
,
**
kwargs
):
...
...
@@ -117,7 +117,7 @@ def deactivate_route(routepk, **kwargs):
except
Exception
as
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
_visible
,
reason_text
,
response
),
route
.
applier
,
route
)
route
.
status
=
"
INACTIVE
"
route
.
response
=
response
route
.
save
()
...
...
@@ -139,7 +139,7 @@ def deactivate_route(routepk, **kwargs):
route
.
status
=
status
route
.
response
=
response
route
.
save
()
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
_visible
,
reason_text
,
response
),
route
.
applier
,
route
)
@shared_task
(
ignore_result
=
True
,
autoretry_for
=
(
TimeoutError
,
TimeLimitExceeded
,
SoftTimeLimitExceeded
),
retry_backoff
=
True
,
retry_kwargs
=
{
'
max_retries
'
:
settings
.
NETCONF_MAX_RETRY_BEFORE_ERROR
})
def
delete_route
(
routepk
,
**
kwargs
):
...
...
@@ -201,7 +201,7 @@ def batch_delete(routes, **kwargs):
route
.
response
=
response
route
.
expires
=
datetime
.
date
.
today
()
route
.
save
()
announce
(
"
[%s] Rule removal: %s%s- Result %s
"
%
(
route
.
applier_username_nice
,
route
.
name
,
reason_text
,
response
),
route
.
applier
,
route
)
announce
(
"
[%s] Rule removal: %s%s- Result %s
"
%
(
route
.
applier_username_nice
,
route
.
name
_visible
,
reason_text
,
response
),
route
.
applier
,
route
)
else
:
return
False
...
...
...
...
This diff is collapsed.
Click to expand it.
flowspec/views.py
+
0
−
1
View file @
0035dddb
...
...
@@ -205,7 +205,6 @@ def overview_routes_ajax(request):
jresp
[
'
aaData
'
]
=
routes
return
HttpResponse
(
json
.
dumps
(
jresp
),
content_type
=
'
application/json
'
)
def
build_routes_json
(
groutes
,
is_superuser
):
routes
=
[]
for
r
in
groutes
.
prefetch_related
(
...
...
...
...
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
sign in
to comment