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

@ -24,9 +24,9 @@ class UpgradeParams:
rollback_sql_filename = config.post_upgrade_rollback_sql_filename
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)
def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\
@ -156,7 +156,7 @@ def do_upgrade_by_argv(argv):
else:
raise MyError('invalid module: {0}'.format(cmd_module))
logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", timeout=\"%s\", module=\"%s\", log-file=\"%s\"',\
host, port, user, password, timeout, module_set, log_filename)
host, port, user, password.replace('"', '\\"'), timeout, module_set, log_filename)
do_upgrade(host, port, user, password, timeout, module_set, upgrade_params)
except mysql.connector.Error, e:
logging.exception('mysql connctor error')

View File

@ -23,9 +23,9 @@ class UpgradeParams:
rollback_sql_filename = config.pre_upgrade_rollback_sql_filename
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)
def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\
@ -146,7 +146,7 @@ def do_upgrade_by_argv(argv):
else:
raise MyError('invalid module: {0}'.format(cmd_module))
logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", timeout=\"%s\", module=\"%s\", log-file=\"%s\"',\
host, port, user, password, timeout, module_set, log_filename)
host, port, user, password.replace('"', '\\"'), timeout, module_set, log_filename)
do_upgrade(host, port, user, password, timeout, module_set, upgrade_params)
except mysql.connector.Error, e:
logging.exception('mysql connctor error')

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')

View File

@ -14,9 +14,9 @@ class UpgradeParams:
log_filename = 'upgrade_cluster_health_checker.log'
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):
@ -445,7 +445,7 @@ if __name__ == '__main__':
timeout = int(get_opt_timeout())
zone = get_opt_zone()
logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", log-file=\"%s\", timeout=%s, zone=\"%s\"', \
host, port, user, password, log_filename, timeout, zone)
host, port, user, password.replace('"', '\\"'), log_filename, timeout, zone)
do_check(host, port, user, password, upgrade_params, timeout, False, zone) # need_check_major_status = False
except mysql.connector.Error, e:
logging.exception('mysql connctor error')

View File

@ -624,9 +624,9 @@
# rollback_sql_filename = config.post_upgrade_rollback_sql_filename
#
#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)
#
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
@ -756,7 +756,7 @@
# else:
# raise MyError('invalid module: {0}'.format(cmd_module))
# logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", timeout=\"%s\", module=\"%s\", log-file=\"%s\"',\
# host, port, user, password, timeout, module_set, log_filename)
# host, port, user, password.replace('"', '\\"'), timeout, module_set, log_filename)
# do_upgrade(host, port, user, password, timeout, module_set, upgrade_params)
# except mysql.connector.Error, e:
# logging.exception('mysql connctor error')
@ -796,9 +796,9 @@
# rollback_sql_filename = config.pre_upgrade_rollback_sql_filename
#
#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)
#
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
@ -919,7 +919,7 @@
# else:
# raise MyError('invalid module: {0}'.format(cmd_module))
# logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", timeout=\"%s\", module=\"%s\", log-file=\"%s\"',\
# host, port, user, password, timeout, module_set, log_filename)
# host, port, user, password.replace('"', '\\"'), timeout, module_set, log_filename)
# do_upgrade(host, port, user, password, timeout, module_set, upgrade_params)
# except mysql.connector.Error, e:
# logging.exception('mysql connctor error')
@ -1675,9 +1675,9 @@
# 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):
@ -2464,7 +2464,7 @@
# 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')
@ -2490,9 +2490,9 @@
# log_filename = 'upgrade_cluster_health_checker.log'
#
#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):
@ -2921,7 +2921,7 @@
# timeout = int(get_opt_timeout())
# zone = get_opt_zone()
# logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", log-file=\"%s\", timeout=%s, zone=\"%s\"', \
# host, port, user, password, log_filename, timeout, zone)
# host, port, user, password.replace('"', '\\"'), log_filename, timeout, zone)
# do_check(host, port, user, password, upgrade_params, timeout, False, zone) # need_check_major_status = False
# except mysql.connector.Error, e:
# logging.exception('mysql connctor error')

View File

@ -624,9 +624,9 @@
# rollback_sql_filename = config.post_upgrade_rollback_sql_filename
#
#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)
#
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
@ -756,7 +756,7 @@
# else:
# raise MyError('invalid module: {0}'.format(cmd_module))
# logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", timeout=\"%s\", module=\"%s\", log-file=\"%s\"',\
# host, port, user, password, timeout, module_set, log_filename)
# host, port, user, password.replace('"', '\\"'), timeout, module_set, log_filename)
# do_upgrade(host, port, user, password, timeout, module_set, upgrade_params)
# except mysql.connector.Error, e:
# logging.exception('mysql connctor error')
@ -796,9 +796,9 @@
# rollback_sql_filename = config.pre_upgrade_rollback_sql_filename
#
#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)
#
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
@ -919,7 +919,7 @@
# else:
# raise MyError('invalid module: {0}'.format(cmd_module))
# logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", timeout=\"%s\", module=\"%s\", log-file=\"%s\"',\
# host, port, user, password, timeout, module_set, log_filename)
# host, port, user, password.replace('"', '\\"'), timeout, module_set, log_filename)
# do_upgrade(host, port, user, password, timeout, module_set, upgrade_params)
# except mysql.connector.Error, e:
# logging.exception('mysql connctor error')
@ -1675,9 +1675,9 @@
# 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):
@ -2464,7 +2464,7 @@
# 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')
@ -2490,9 +2490,9 @@
# log_filename = 'upgrade_cluster_health_checker.log'
#
#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):
@ -2921,7 +2921,7 @@
# timeout = int(get_opt_timeout())
# zone = get_opt_zone()
# logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", log-file=\"%s\", timeout=%s, zone=\"%s\"', \
# host, port, user, password, log_filename, timeout, zone)
# host, port, user, password.replace('"', '\\"'), log_filename, timeout, zone)
# do_check(host, port, user, password, upgrade_params, timeout, False, zone) # need_check_major_status = False
# except mysql.connector.Error, e:
# logging.exception('mysql connctor error')