[PR #11072/b5157b68 backport][stable-12] opendj_backendprop: use check_rc (#11077)

opendj_backendprop: use check_rc (#11072)

* opendj_backendprop: use check_rc

* add changelog frag

(cherry picked from commit b5157b68ba)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot]
2025-11-10 20:34:42 +01:00
committed by GitHub
parent a78d0d2263
commit 1951f70c00
2 changed files with 6 additions and 10 deletions

View File

@@ -0,0 +1,2 @@
minor_changes:
- opendj_backendprop - use Ansible construct to perform check for external commands (https://github.com/ansible-collections/community.general/pull/11072).

View File

@@ -112,11 +112,8 @@ class BackendProp:
"-X",
"-s",
] + password_method
rc, stdout, stderr = self._module.run_command(my_command)
if rc == 0:
return stdout
else:
self._module.fail_json(msg=f"Error message: {stderr}")
rc, stdout, stderr = self._module.run_command(my_command, check_rc=True)
return stdout
def set_property(self, opendj_bindir, hostname, port, username, password_method, backend_name, name, value):
my_command = [
@@ -135,11 +132,8 @@ class BackendProp:
"-n",
"-X",
] + password_method
rc, stdout, stderr = self._module.run_command(my_command)
if rc == 0:
return True
else:
self._module.fail_json(msg=f"Error message: {stderr}")
self._module.run_command(my_command, check_rc=True)
return True
def validate_data(self, data=None, name=None, value=None):
for config_line in data.split("\n"):