wip: build ldap and message processing

This commit is contained in:
2023-07-14 17:37:32 +02:00
parent 4af3cfcedd
commit c30bfd265a
3 changed files with 66 additions and 82 deletions

26
messagetools.py Normal file
View File

@@ -0,0 +1,26 @@
class UnsupportedStruct(Exception):
def __init__(self, struct):
self.message = "{} is invalid struct and not a message".format(str(struct))
super().__init__(self.message)
def make_icinga_message(struct):
pass
def make_generic_message(struct):
pass
def load_struct(struct):
if type(struct) == str:
return struct
elif not struct.get("type"):
raise UnsupportedStruct(struct)
if struct.get("type") == "icinga":
return make_icinga_message(struct)
elif struct.get("type") == "generic":
return make_generic_message(struct)
else:
raise UnsupportedStruct(struct)