From 60752bc75391104f72ab6920f066691c3901660b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Dunand?= Date: Fri, 6 Dec 2024 14:01:42 +0100 Subject: [PATCH] Fix handling of kubeadm bootstrap token without expiration --- plugins/filter/bootstrap_token.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/filter/bootstrap_token.py b/plugins/filter/bootstrap_token.py index c8b6a09..2082699 100644 --- a/plugins/filter/bootstrap_token.py +++ b/plugins/filter/bootstrap_token.py @@ -31,11 +31,14 @@ def _token_filter(self, token_list, now=None): else: threshold = arrow.utcnow() for token in token_list: - if ( - arrow.get(base64.b64decode(token["data"]["expiration"]).decode("utf-8")) - >= threshold - ): - yield token + try: + if ( + arrow.get(base64.b64decode(token["data"]["expiration"]).decode("utf-8")) + >= threshold + ): + yield token + except KeyError: + continue if __name__ == "__main__":