centralized bad password handling, fixed outputing of become method

This commit is contained in:
Brian Coca 2015-06-15 01:40:53 -04:00
commit 1ce1c52f6f
2 changed files with 5 additions and 7 deletions

View file

@ -130,5 +130,6 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
def check_incorrect_password(self, output, prompt):
incorrect_password = gettext.dgettext(self._connection_info.become_method, C.BECOME_ERROR_STRINGS[self._connection_info.become_method])
return output.endswith(incorrect_password)
if output.endswith(incorrect_password):
raise AnsibleError('Incorrect %s password' % self._connection_info.become_method)