Created
March 22, 2017 08:00
-
-
Save ktechmidas/ce4114403c5db0332d1002d18b680ed6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_mysql_user(self, user, password, host=None): | |
print '\nverifying password of user %s ... ' % user, | |
kwargs = dict(host=host or self.mysql_host, | |
port=self.mysql_port, | |
user=user, | |
passwd=password) | |
try: | |
conn = MySQLdb.connect(**kwargs) | |
except Exception, e: | |
pdb.set_trace() | |
if isinstance(e, MySQLdb.OperationalError): | |
raise InvalidAnswer('Failed to connect to mysql server using user "%s" and password "***": %s' \ | |
% (user, e.args[1])) | |
else: | |
raise InvalidAnswer('Failed to connect to mysql server using user "%s" and password "***": %s' \ | |
% (user, e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment