Dont add finalizer
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2023-10-13 15:13:17 +03:00
parent 945ed77d58
commit ae94edc14a

View File

@ -11,6 +11,9 @@ devenv = bool(os.getenv("DEV_ENV", False))
api_key = os.environ["API_KEY"]
users_lookup = {}
def resource_is_deleted(event, **_):
return event["type"] == "DELETED"
def authorized():
def decorator(f):
@wraps(f)
@ -66,7 +69,7 @@ async def save_handler(body, **_):
print(f"Saving {username}")
users_lookup[username] = user
@kopf.on.delete('oidcgatewayusers')
@kopf.on.event('', 'v1', 'oidcgatewayusers', when=resource_is_deleted)
async def delete_handler(body, **_):
username = body['metadata']['name']
print(f"Deleting {username}")