fix(gpg_secretstore): ensure import errors get properly passed to fail_json

This commit is contained in:
transcaffeine 2024-01-25 11:40:01 +01:00
parent f54e12561b
commit 0e98261665
No known key found for this signature in database
GPG key ID: 03624C433676E465

View file

@ -360,10 +360,11 @@ def main():
error_map = check_secretstore_import_errors() | check_module_import_errors() error_map = check_secretstore_import_errors() | check_module_import_errors()
for lib, exception in error_map.items(): for lib, exception in error_map.items():
warnings.append(f"Missing python library: {lib}")
errors.append(missing_required_lib(lib)) errors.append(missing_required_lib(lib))
traceback.append(exception) traceback.append(str(exception))
if errors: if errors:
module.fail_json(warning=',\n'.join(warnings), errors=errors, traceback="\n".join(traceback)) module.fail_json(warning=',\n'.join(warnings), errors=errors, traceback="\n".join(traceback), msg=',\n'.join(warnings))
store = SecretStore( store = SecretStore(
password_store_path=module.params["password_store_path"], password_store_path=module.params["password_store_path"],