From 49c7253f24fa602c03bf83c839dd8a72c564d45b Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sun, 9 Nov 2025 20:14:56 +1300 Subject: [PATCH] zfs_facts: use check_rc (#11054) * zfs_facts: use check_rc * add changelog frag --- changelogs/fragments/11054-zfs-facts-checkrc.yml | 2 ++ plugins/modules/zfs_facts.py | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/11054-zfs-facts-checkrc.yml diff --git a/changelogs/fragments/11054-zfs-facts-checkrc.yml b/changelogs/fragments/11054-zfs-facts-checkrc.yml new file mode 100644 index 0000000000..fc702fb292 --- /dev/null +++ b/changelogs/fragments/11054-zfs-facts-checkrc.yml @@ -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). diff --git a/plugins/modules/zfs_facts.py b/plugins/modules/zfs_facts.py index f6f4ecf8b4..b7c7dbb294 100644 --- a/plugins/modules/zfs_facts.py +++ b/plugins/modules/zfs_facts.py @@ -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")