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:
parent
8b1d725fb2
commit
b5157b68ba
2 changed files with 6 additions and 10 deletions
2
changelogs/fragments/11072-opendj-checkrc.yml
Normal file
2
changelogs/fragments/11072-opendj-checkrc.yml
Normal 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).
|
||||
|
|
@ -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"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue