From 6668d82f40a75aa732db415ef7a4c3ba04ea7b02 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Fri, 21 Apr 2023 21:05:03 +0200 Subject: [PATCH] fixed get --- plugins/module_utils/module.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index 16eae83..676ae4f 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -85,12 +85,10 @@ class AnsibleModule(object): def get(self, key: str, default: T = None) -> T: """returns an Parameter of the Module.""" - if key not in self.params.keys(): - return default + if key not in self.params: + raise KeyError() if self.params[key] is None and default is not None: return default - if self.params[key] is None or key not in self.params: - raise KeyError() return self.params[key] def changed_get(self):