From 691461cd8cf022b6d3649f3758e2b62d7e2122f1 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 22 Mar 2019 09:17:49 -0500 Subject: [PATCH] roles/winbind: Fix error handling in ads_member This commit fixes a couple of issues with the `ads_member` module surrounding handling of errors from the `net ads join` command. --- roles/winbind/library/ads_member | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/winbind/library/ads_member b/roles/winbind/library/ads_member index e312b2a..12e5c16 100644 --- a/roles/winbind/library/ads_member +++ b/roles/winbind/library/ads_member @@ -32,7 +32,7 @@ def join_domain(username, password): stderr=subprocess.STDOUT, env=_make_env(), ) - output = p.communicate(password.encode('utf-8')) + output = p.communicate(password.encode('utf-8'))[0] if p.wait() != 0: raise JoinFailed(output.decode('utf-8')) @@ -46,7 +46,7 @@ def leave_domain(username, password): stderr=subprocess.STDOUT, env=_make_env(), ) - output = p.communicate(password.encode('utf-8')) + output = p.communicate(password.encode('utf-8'))[0] if p.wait() != 0: raise JoinFailed(output.decode('utf-8')) @@ -95,7 +95,7 @@ def main(): try: join_domain(username, password) except JoinFailed as e: - module.fail_json(message=e.args[0]) + module.fail_json(msg=e.args[0]) module.exit_json(changed=changed)