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

opendj_backendprop: use check_rc (#11072)

* opendj_backendprop: use check_rc

* add changelog frag
This commit is contained in:
Alexei Znamensky 2025-11-10 19:36:21 +13:00 committed by GitHub
parent 8b1d725fb2
commit b5157b68ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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"):