diff --git a/changelogs/fragments/12185-aix-devices-chdev-fail.yml b/changelogs/fragments/12185-aix-devices-chdev-fail.yml new file mode 100644 index 0000000000..20c31ee050 --- /dev/null +++ b/changelogs/fragments/12185-aix-devices-chdev-fail.yml @@ -0,0 +1,2 @@ +bugfixes: + - "aix_devices - fix ``chdev`` command failures being incorrectly reported as successful results, now properly fails the task when device attribute changes cannot be applied (https://github.com/ansible-collections/community.general/pull/12185)." diff --git a/plugins/modules/aix_devices.py b/plugins/modules/aix_devices.py index 9b1ba585b2..56dbe25960 100644 --- a/plugins/modules/aix_devices.py +++ b/plugins/modules/aix_devices.py @@ -235,7 +235,7 @@ def change_device_attr(module, attributes, device, force): if not module.check_mode: rc, chdev_out, err = module.run_command(cmd) if rc != 0: - module.exit_json(msg="Failed to run chdev.", rc=rc, err=err) + module.fail_json(msg="Failed to run chdev.", rc=rc, err=err) attr_changed.append(attributes[attr]) else: