scripts/eddn-report-log-errors: Use fileinput & update for latest

* Use fileinput, makes it easy to use '-' as 'stdin please'.
* EDDLite 2.0.0.0: Bad date-time
* EDMC >= 5.2.4: approachsettelement/1 issues
This commit is contained in:
Athanasius 2022-02-18 18:07:14 +00:00
parent 05d5d0215a
commit 8c2a5dca6f

View File

@ -3,6 +3,7 @@
"""Produce a report on the provided EDDN Gateway log file's ERRORs."""
import argparse
import fileinput
import re
import semantic_version
@ -45,7 +46,7 @@ def process_file(input_file: str) -> None:
r' from (?P<sender_ip>.+)$'
)
# TODO: Make this handle gzipped files
with open(input_file, 'r') as input:
with fileinput.FileInput(files=(input_file), mode='r') as input:
line = input.readline()
while line:
line = line.strip()
@ -87,10 +88,22 @@ def process_file(input_file: str) -> None:
'https://eddn.edcd.io/schemas/shipyard/2',
'https://eddn.edcd.io/schemas/outfitting/2',
):
# Reported via Discord PM to Robby 2022-01-07
if matches.group('err_msg') != 'Failed Validation "[<ValidationError: \'[] is too short\'>]"':
# Failed Validation "[<ValidationError: "'2022-02-17T14.25.19Z' is not a 'date-time'">]"
if (
matches.group('err_msg').startswith('Failed Validation "[<ValidationError: "') and
matches.group('err_msg').endswith('\' is not a \'date-time\'">]"')
):
# <https://github.com/EDDiscovery/EDDLite/issues/8>
pass
elif matches.group('err_msg') == 'Failed Validation "[<ValidationError: \'[] is too short\'>]"':
# Reported via Discord PM to Robby 2022-01-07
pass
else:
print(line)
else:
print(line)
@ -129,6 +142,15 @@ def process_file(input_file: str) -> None:
# <https://github.com/EDCD/EDMarketConnector/issues/1403>
pass
elif matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/approachsettlement/1':
if matches.group('err_msg') == 'Failed Validation "[<ValidationError: "\'MarketID\' is a required property">]"':
# <https://github.com/EDCD/EDDN/issues/181>
pass
elif matches.group('err_msg') == 'Failed Validation "[<ValidationError: "\'Latitude\' is a required property">]"':
# <https://github.com/EDCD/EDMarketConnector/issues/1476>
pass
else:
print(line)