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):