fix empty password

This commit is contained in:
obdev
2024-05-07 12:20:38 +00:00
committed by ob-robot
parent 3d804e3693
commit ea454e2ce9
6 changed files with 48 additions and 48 deletions

View File

@ -15,9 +15,9 @@ class UpgradeParams:
old_version = '4.0.0.0'
class PasswordMaskingFormatter(logging.Formatter):
def format(self, record):
s = super(PasswordMaskingFormatter, self).format(record)
return re.sub(r'password=\".*?\"', 'password=\"******\"', s)
def format(self, record):
s = super(PasswordMaskingFormatter, self).format(record)
return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
#### --------------start : my_error.py --------------
class MyError(Exception):
@ -804,7 +804,7 @@ if __name__ == '__main__':
password = get_opt_password()
timeout = int(get_opt_timeout())
logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", timeout=\"%s\", log-file=\"%s\"',\
host, port, user, password, timeout, log_filename)
host, port, user, password.replace('"', '\\"'), timeout, log_filename)
do_check(host, port, user, password, timeout, upgrade_params)
except mysql.connector.Error, e:
logging.exception('mysql connctor error')