Skip to content

Commit ab385f7

Browse files
kamil-certatsebix
authored andcommitted
Simplify and fix upgrade function
1 parent 2c9f753 commit ab385f7

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

intelmq/lib/upgrades.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -976,22 +976,6 @@ def v340_deprecations(configuration, harmonization, dry_run, **kwargs):
976976
return message or changed, configuration, harmonization
977977

978978

979-
def v341_new_fields(configuration, harmonization, dry_run, **kwargs):
980-
"""
981-
Add new fields to IntelMQ Data Format
982-
"""
983-
changed = False
984-
if "event" in harmonization and "severity" not in harmonization["event"]:
985-
harmonization["event"]["severity"] = {
986-
"description": "Severity of the event, based on the information from the source, and eventually modified by IntelMQ during processing. Meaning of the levels may differ based on the event source.",
987-
"length": 10,
988-
"regex": "^(critical|high|medium|low|info|undefined)$",
989-
"type": "LowercaseString",
990-
}
991-
changed = True
992-
return changed, configuration, harmonization
993-
994-
995979
def v341_blueliv_removal(configuration, harmonization, dry_run, **kwargs):
996980
"""
997981
Remove blueliv collector and parser
@@ -1027,6 +1011,7 @@ def v342_new_fields(configuration, harmonization, dry_run, **kwargs):
10271011
resource_filename("intelmq", "etc/harmonization.conf")
10281012
)
10291013
for field in [
1014+
"severity",
10301015
"product.full_name",
10311016
"product.name",
10321017
"product.vendor",

intelmq/tests/lib/test_upgrades.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,6 @@ def test_v342_new_fields(self):
876876
""" Test adding new harmonisation fields """
877877
result = upgrades.v342_new_fields({}, {"event": {"old-field": "must stay"}}, False)
878878
self.assertTrue(result[0])
879-
self.assertIn("old-field", result[1]["event"])
880-
self.assertIn("severity", result[1]["event"])
881879
self.assertIn("old-field", result[2]["event"])
882880
self.assertIn("product.full_name", result[2]["event"])
883881
self.assertIn("product.name", result[2]["event"])

0 commit comments

Comments
 (0)