mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge branch 'warn_wrong_sudo_password' of https://github.com/tyll/ansible into tyll-warn_wrong_sudo_password
This commit is contained in:
commit
51ef28b0d2
1 changed files with 10 additions and 5 deletions
|
@ -157,12 +157,17 @@ class Connection(object):
|
||||||
rfd, wfd, efd = select.select(rpipes, [], rpipes, 1)
|
rfd, wfd, efd = select.select(rpipes, [], rpipes, 1)
|
||||||
|
|
||||||
# fail early if the sudo/su password is wrong
|
# fail early if the sudo/su password is wrong
|
||||||
if self.runner.sudo and sudoable and self.runner.sudo_pass:
|
if self.runner.sudo and sudoable:
|
||||||
|
if self.runner.sudo_pass:
|
||||||
incorrect_password = gettext.dgettext(
|
incorrect_password = gettext.dgettext(
|
||||||
"sudo", "Sorry, try again.")
|
"sudo", "Sorry, try again.")
|
||||||
if stdout.endswith("%s\r\n%s" % (incorrect_password, prompt)):
|
if stdout.endswith("%s\r\n%s" % (incorrect_password,
|
||||||
|
prompt)):
|
||||||
raise errors.AnsibleError('Incorrect sudo password')
|
raise errors.AnsibleError('Incorrect sudo password')
|
||||||
|
|
||||||
|
if stdout.endswith(prompt):
|
||||||
|
raise errors.AnsibleError('Missing sudo password')
|
||||||
|
|
||||||
if self.runner.su and su and self.runner.su_pass:
|
if self.runner.su and su and self.runner.su_pass:
|
||||||
incorrect_password = gettext.dgettext(
|
incorrect_password = gettext.dgettext(
|
||||||
"su", "Sorry")
|
"su", "Sorry")
|
||||||
|
|
Loading…
Reference in a new issue