1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

zfs_facts: use check_rc (#11054)

* zfs_facts: use check_rc

* add changelog frag
This commit is contained in:
Alexei Znamensky 2025-11-09 20:14:56 +13:00 committed by GitHub
parent 396f467bbb
commit 49c7253f24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 6 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- zfs_facts - use Ansible construct to check result of external command (https://github.com/ansible-collections/community.general/pull/11054).

View file

@ -193,12 +193,7 @@ class ZFSFacts:
cmd.append(",".join(self.type))
cmd.extend(["-o", "name,property,value", self.properties, self.name])
(rc, out, err) = self.module.run_command(cmd)
if rc != 0:
self.module.fail_json(
msg=f"Error while trying to get facts about ZFS dataset: {self.name}", stderr=err, rc=rc
)
(rc, out, err) = self.module.run_command(cmd, check_rc=True)
for line in out.splitlines():
dataset, property, value = line.split("\t")