Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mentat Test 3
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
713
Mentat
Mentat Test 3
Commits
4e480335
Commit
4e480335
authored
1 year ago
by
Rajmund Hruška
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/judiny-bugfix-#7556-abuse_group_mail' into devel
parents
983b96cd
373220e8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/mentat/module/netmngr.py
+5
-8
5 additions, 8 deletions
lib/mentat/module/netmngr.py
lib/mentat/reports/test_utils.py
+0
-1
0 additions, 1 deletion
lib/mentat/reports/test_utils.py
lib/mentat/reports/utils.py
+1
-3
1 addition, 3 deletions
lib/mentat/reports/utils.py
with
6 additions
and
12 deletions
lib/mentat/module/netmngr.py
+
5
−
8
View file @
4e480335
...
...
@@ -375,7 +375,7 @@ class MentatNetmngrScript(mentat.script.fetcher.FetcherScript):
# from the whois file with those from the database, the name of each group from database is computed
# in the same way as the name of a group from the whois file.
emails
=
list
(
set
((
abg
.
settings_rep
.
emails_low
or
[])
+
(
abg
.
settings_rep
.
emails_medium
or
[])
+
(
abg
.
settings_rep
.
emails_high
or
[])
+
(
abg
.
settings_rep
.
emails_critical
or
[])))
name
=
'
,
'
.
join
(
sorted
(
map
(
str
.
lower
,
emails
if
emails
else
[
abg
.
name
]
)))
name
=
'
,
'
.
join
(
sorted
(
map
(
str
.
lower
,
emails
)))
abuse_group_dict
[
name
]
=
abg
self
.
logger
.
info
(
"
Number of abuse groups in database: %d
"
,
len
(
abuse_groups
))
...
...
@@ -458,13 +458,10 @@ class MentatNetmngrScript(mentat.script.fetcher.FetcherScript):
if
abuse_group
in
abuse_group_dict
:
s
=
abuse_group_dict
[
abuse_group
].
settings_rep
if
not
(
s
.
emails_low
or
s
.
emails_medium
or
s
.
emails_high
or
s
.
emails_critical
):
emails
[
'
low
'
].
append
([
abuse_group
])
else
:
emails
[
'
low
'
].
append
(
sorted
(
s
.
emails_low
or
[]))
emails
[
'
medium
'
].
append
(
sorted
(
s
.
emails_medium
or
[]))
emails
[
'
high
'
].
append
(
sorted
(
s
.
emails_high
or
[]))
emails
[
'
critical
'
].
append
(
sorted
(
s
.
emails_critical
or
[]))
emails
[
'
low
'
].
append
(
sorted
(
s
.
emails_low
or
[]))
emails
[
'
medium
'
].
append
(
sorted
(
s
.
emails_medium
or
[]))
emails
[
'
high
'
].
append
(
sorted
(
s
.
emails_high
or
[]))
emails
[
'
critical
'
].
append
(
sorted
(
s
.
emails_critical
or
[]))
for
severity
in
[
'
low
'
,
'
medium
'
,
'
high
'
,
'
critical
'
]:
if
not
all
(
x
==
emails
[
severity
][
0
]
for
x
in
emails
[
severity
]):
...
...
This diff is collapsed.
Click to expand it.
lib/mentat/reports/test_utils.py
+
0
−
1
View file @
4e480335
...
...
@@ -265,7 +265,6 @@ class TestMentatReportsUtils(unittest.TestCase):
self
.
assertEqual
(
str
(
reporting_settings
.
filters
),
"
[<Filter(name=
'
FLT1
'
)>, <Filter(name=
'
FLT2
'
)>]
"
)
self
.
assertEqual
(
str
(
reporting_settings
.
networks
),
"
[<Network(netname=
'
UNET1
'
,network=
'
10.0.0.0/8
'
)>]
"
)
self
.
assertEqual
(
reporting_settings
.
mode
,
'
summary
'
)
self
.
assertEqual
(
reporting_settings
.
emails
,
([
'
abuse@cesnet.cz
'
],
[],
[],
[]))
self
.
assertEqual
(
reporting_settings
.
redirect
,
False
)
self
.
assertEqual
(
reporting_settings
.
template
,
'
default
'
)
self
.
assertEqual
(
reporting_settings
.
locale
,
'
en
'
)
...
...
This diff is collapsed.
Click to expand it.
lib/mentat/reports/utils.py
+
1
−
3
View file @
4e480335
...
...
@@ -62,9 +62,7 @@ class ReportingSettings: # pylint: disable=locally-disabled,too-many-instance-at
@staticmethod
def
_init_emails
(
group_value
,
settings
):
if
settings
.
emails_low
or
settings
.
emails_medium
or
settings
.
emails_high
or
settings
.
emails_critical
:
return
(
settings
.
emails_low
,
settings
.
emails_medium
,
settings
.
emails_high
,
settings
.
emails_critical
)
return
([
group_value
],
[],
[],
[])
return
(
settings
.
emails_low
,
settings
.
emails_medium
,
settings
.
emails_high
,
settings
.
emails_critical
)
@staticmethod
def
_init_mode
(
group_value
,
**
kwargs
):
...
...
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