Skip to content

Commit b5157b6

Browse files
authored
opendj_backendprop: use check_rc (#11072)
* opendj_backendprop: use check_rc * add changelog frag
1 parent 8b1d725 commit b5157b6

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- opendj_backendprop - use Ansible construct to perform check for external commands (https://github.com/ansible-collections/community.general/pull/11072).

plugins/modules/opendj_backendprop.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,8 @@ def get_property(self, opendj_bindir, hostname, port, username, password_method,
112112
"-X",
113113
"-s",
114114
] + password_method
115-
rc, stdout, stderr = self._module.run_command(my_command)
116-
if rc == 0:
117-
return stdout
118-
else:
119-
self._module.fail_json(msg=f"Error message: {stderr}")
115+
rc, stdout, stderr = self._module.run_command(my_command, check_rc=True)
116+
return stdout
120117

121118
def set_property(self, opendj_bindir, hostname, port, username, password_method, backend_name, name, value):
122119
my_command = [
@@ -135,11 +132,8 @@ def set_property(self, opendj_bindir, hostname, port, username, password_method,
135132
"-n",
136133
"-X",
137134
] + password_method
138-
rc, stdout, stderr = self._module.run_command(my_command)
139-
if rc == 0:
140-
return True
141-
else:
142-
self._module.fail_json(msg=f"Error message: {stderr}")
135+
self._module.run_command(my_command, check_rc=True)
136+
return True
143137

144138
def validate_data(self, data=None, name=None, value=None):
145139
for config_line in data.split("\n"):

0 commit comments

Comments
 (0)