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.jenkins-master
parent
159a42bb70
commit
691461cd8c
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue