mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
[PR #11095/2b4333a0 backport][stable-12] Use raise from in plugins (#11129)
Use raise from in plugins (#11095)
* Use raise from.
* Add changelog fragment.
(cherry picked from commit 2b4333a033)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -166,8 +166,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
||||
except Exception:
|
||||
error_body = {"status": None}
|
||||
if e.code == 404 and error_body.get("status") == "No objects found.":
|
||||
raise AnsibleParserError("Host filter returned no data. Please confirm your host_filter value is valid")
|
||||
raise AnsibleParserError(f"Unexpected data returned: {e} -- {error_body}")
|
||||
raise AnsibleParserError(
|
||||
"Host filter returned no data. Please confirm your host_filter value is valid"
|
||||
) from e
|
||||
raise AnsibleParserError(f"Unexpected data returned: {e} -- {error_body}") from e
|
||||
|
||||
response_body = response.read()
|
||||
json_data = json.loads(response_body.decode("utf-8"))
|
||||
|
||||
Reference in New Issue
Block a user