mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +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:
@@ -122,10 +122,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
||||
with open(authfile, "r") as fp:
|
||||
authstring = fp.read().rstrip()
|
||||
username, password = authstring.split(":")
|
||||
except (OSError, IOError):
|
||||
raise AnsibleError(f"Could not find or read ONE_AUTH file at '{authfile}'")
|
||||
except Exception:
|
||||
raise AnsibleError(f"Error occurs when reading ONE_AUTH file at '{authfile}'")
|
||||
except (OSError, IOError) as e:
|
||||
raise AnsibleError(f"Could not find or read ONE_AUTH file at '{authfile}'") from e
|
||||
except Exception as e:
|
||||
raise AnsibleError(f"Error occurs when reading ONE_AUTH file at '{authfile}'") from e
|
||||
|
||||
auth_params = namedtuple("auth", ("url", "username", "password"))
|
||||
|
||||
@@ -167,7 +167,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
||||
try:
|
||||
vm_pool = one_client.vmpool.infoextended(-2, -1, -1, 3)
|
||||
except Exception as e:
|
||||
raise AnsibleError(f"Something happened during XML-RPC call: {e}")
|
||||
raise AnsibleError(f"Something happened during XML-RPC call: {e}") from e
|
||||
|
||||
return vm_pool
|
||||
|
||||
|
||||
Reference in New Issue
Block a user