Skip to content

Commit d6411f2

Browse files
authored
Merge pull request #377 from adam-hamilton/luman_parser_fixes_v2
Fix Lumen parser status for scheduled maintenance
2 parents ce946b7 + aab87b7 commit d6411f2

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

changes/377.fixed.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed Lumen parser incorrectly marking scheduled future maintenance events as IN-PROCESS instead of CONFIRMED. Bug introduced in commit 737aa4e9 (Aug 2021).

circuit_maintenance_parser/parsers/lumen.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ def parse_spans(self, spans: ResultSet, data: Dict):
6060
for sibling in line.next_siblings:
6161
text_sibling = sibling.text.strip() if isinstance(sibling, bs4.element.Tag) else sibling.strip()
6262
if text_sibling != "":
63-
if (
64-
"This maintenance is scheduled" in text_sibling
65-
or "The scheduled maintenance work has begun" in text_sibling
66-
):
63+
if "The scheduled maintenance work has begun" in text_sibling:
6764
data["status"] = Status("IN-PROCESS")
65+
elif "This maintenance is scheduled" in text_sibling:
66+
data["status"] = Status("CONFIRMED")
6867
if "GMT" in text_sibling:
6968
stamp = parser.parse(text_sibling.split(" GMT")[0])
7069
data["stamp"] = self.dt2ts(stamp)

tests/unit/data/lumen/lumen3_result.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"maintenance_id": "987654321-1",
1212
"stamp": 1621494021,
1313
"start": 1621494000,
14-
"status": "IN-PROCESS",
14+
"status": "CONFIRMED",
1515
"summary": "Lumen intends to carry out internal maintenance within its network. This has been designated as EMERGENCY. The nature of this work is to replace faulty hardware and is required in order to improve network reliability and continue providing optimal service for our clients."
1616
}
1717
]

tests/unit/data/lumen/lumen4_result.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"maintenance_id": "123456789",
1212
"stamp": 1628869538,
1313
"start": 1629950400,
14-
"status": "IN-PROCESS",
14+
"status": "CONFIRMED",
1515
"summary": "Lumen will implement scheduled maintenance as part of a large scale project to upgrade code on the IP platform. This maintenance activity is one of several maintenances taking place across various locations in multiple regions. The upgrade will mitigate an existing defect in the current software version and prevent future network outages."
1616
}
1717
]

tests/unit/data/lumen/lumen8_result.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"maintenance_id": "12345678",
1616
"stamp": 1678379003,
1717
"start": 1679457600,
18-
"status": "IN-PROCESS",
18+
"status": "CONFIRMED",
1919
"summary": "Lumen intends to carry out internal maintenance within its network. This has been designated as ESSENTIAL. The nature of this work is to repair fiber and is required in order to avoid unplanned outages from damages related to natural causes."
2020
},
2121
{
@@ -34,7 +34,7 @@
3434
"maintenance_id": "12345678",
3535
"stamp": 1678379003,
3636
"start": 1679544000,
37-
"status": "IN-PROCESS",
37+
"status": "CONFIRMED",
3838
"summary": "Lumen intends to carry out internal maintenance within its network. This has been designated as ESSENTIAL. The nature of this work is to repair fiber and is required in order to avoid unplanned outages from damages related to natural causes."
3939
}
4040
]

0 commit comments

Comments
 (0)