Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Direct Parser #84

Merged
merged 11 commits into from
Sep 28, 2021
Merged

AWS Direct Parser #84

merged 11 commits into from
Sep 28, 2021

Conversation

carbonarok
Copy link
Contributor

Parser for AWS notifications

def parser_hook(self, raw: bytes):
"""Execute parsing."""
result = []
soup = bs4.BeautifulSoup(quopri.decodestring(raw), features="lxml")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this look like a Html parser? maybe we should add the text/plain into that data_type. I see it too much HTML specific for a generic Text parser

maintenace_id += str(data["start"])
data["end"] = self.dt2ts(parser.parse(search.group(2)))
if "may become unavailable" in line.lower():
impact = "DEGRADED"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unavailable = OUTAGE

_processors: List[GenericProcessor] = [
CombinedProcessor(data_parsers=[EmailDateParser, TextParserAWS1, SubjectParserAWS1]),
]
_default_organizer = "aaaaaaaaaaaaaaa"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is wrong

],
"end": 1621519200,
"maintenance_id": "21264c558a1b6a2bedaae0878d6318b0",
"organizer": "aaaaaaaaaaaaaaa",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong

"""Execute parsing."""
result = []
soup = bs4.BeautifulSoup(quopri.decodestring(raw), features="lxml")
# Even we have not noticed any HTML notification with more than one maintenance yet, we define the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not true :) , we have Sparkle



class Text(Parser):
"""Html parser."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

if "may become unavailable" in line.lower():
impact = Impact.OUTAGE
elif "has been cancelled" in line.lower():
impact = Impact.NO_IMPACT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not change the impact type, even Cancelled

return result

@staticmethod
def get_text_hook(raw):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def get_text_hook(raw):
def get_text_hook(raw: bytes) -> str:

chadell
chadell previously approved these changes Sep 28, 2021
Copy link
Collaborator

@chadell chadell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (update changelog and add a note for the maintenance_id hash point for future reference)

Copy link
Collaborator

@chadell chadell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @carbonarok !

@carbonarok carbonarok merged commit 78672d0 into develop Sep 28, 2021
@carbonarok carbonarok deleted the kc_aws_parser branch September 28, 2021 15:57
@chadell chadell mentioned this pull request Sep 28, 2021
@glennmatthews glennmatthews mentioned this pull request Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants