Skip to content

Commit

Permalink
Fix the upgrade script when password is less than 6 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
obdev authored and ob-robot committed Jun 20, 2024
1 parent 1169ba5 commit 92546c1
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 72 deletions.
9 changes: 3 additions & 6 deletions tools/upgrade/do_upgrade_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@ class UpgradeParams:
class PasswordMaskingFormatter(logging.Formatter):
def format(self, record):
s = super(PasswordMaskingFormatter, self).format(record)
return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)

def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\
format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
datefmt='%Y-%m-%d %H:%M:%S',\
filename=log_filenamme,\
filemode='w')
logger = logging.getLogger('')
logger.setLevel(logging.INFO)
# 定义日志打印格式
formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
#######################################
Expand Down
9 changes: 3 additions & 6 deletions tools/upgrade/do_upgrade_pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@ class UpgradeParams:
class PasswordMaskingFormatter(logging.Formatter):
def format(self, record):
s = super(PasswordMaskingFormatter, self).format(record)
return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)

def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\
format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
datefmt='%Y-%m-%d %H:%M:%S',\
filename=log_filenamme,\
filemode='w')
logger = logging.getLogger('')
logger.setLevel(logging.INFO)
# 定义日志打印格式
formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
#######################################
Expand Down
9 changes: 3 additions & 6 deletions tools/upgrade/upgrade_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UpgradeParams:
class PasswordMaskingFormatter(logging.Formatter):
def format(self, record):
s = super(PasswordMaskingFormatter, self).format(record)
return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)

#### --------------start : my_error.py --------------
class MyError(Exception):
Expand Down Expand Up @@ -282,11 +282,8 @@ def get_opt_log_file():

#### --------------start : do_upgrade_pre.py--------------
def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\
format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
datefmt='%Y-%m-%d %H:%M:%S',\
filename=log_filenamme,\
filemode='w')
logger = logging.getLogger('')
logger.setLevel(logging.INFO)
# 定义日志打印格式
formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
#######################################
Expand Down
9 changes: 3 additions & 6 deletions tools/upgrade/upgrade_health_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class UpgradeParams:
class PasswordMaskingFormatter(logging.Formatter):
def format(self, record):
s = super(PasswordMaskingFormatter, self).format(record)
return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)

#### --------------start : my_error.py --------------
class MyError(Exception):
Expand Down Expand Up @@ -263,11 +263,8 @@ def get_opt_zone():

#### --------------start : do_upgrade_pre.py--------------
def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\
format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
datefmt='%Y-%m-%d %H:%M:%S',\
filename=log_filenamme,\
filemode='w')
logger = logging.getLogger('')
logger.setLevel(logging.INFO)
# 定义日志打印格式
formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
#######################################
Expand Down
36 changes: 12 additions & 24 deletions tools/upgrade/upgrade_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,14 +626,11 @@
#class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(record)
# return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
# return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)
#
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# logger = logging.getLogger('')
# logger.setLevel(logging.INFO)
# # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# #######################################
Expand Down Expand Up @@ -798,14 +795,11 @@
#class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(record)
# return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
# return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)
#
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# logger = logging.getLogger('')
# logger.setLevel(logging.INFO)
# # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# #######################################
Expand Down Expand Up @@ -1677,7 +1671,7 @@
#class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(record)
# return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
# return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)
#
##### --------------start : my_error.py --------------
#class MyError(Exception):
Expand Down Expand Up @@ -1942,11 +1936,8 @@
#
##### --------------start : do_upgrade_pre.py--------------
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# logger = logging.getLogger('')
# logger.setLevel(logging.INFO)
# # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# #######################################
Expand Down Expand Up @@ -2492,7 +2483,7 @@
#class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(record)
# return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
# return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)
#
##### --------------start : my_error.py --------------
#class MyError(Exception):
Expand Down Expand Up @@ -2739,11 +2730,8 @@
#
##### --------------start : do_upgrade_pre.py--------------
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# logger = logging.getLogger('')
# logger.setLevel(logging.INFO)
# # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# #######################################
Expand Down
36 changes: 12 additions & 24 deletions tools/upgrade/upgrade_pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,14 +626,11 @@
#class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(record)
# return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
# return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)
#
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# logger = logging.getLogger('')
# logger.setLevel(logging.INFO)
# # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# #######################################
Expand Down Expand Up @@ -798,14 +795,11 @@
#class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(record)
# return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
# return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)
#
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# logger = logging.getLogger('')
# logger.setLevel(logging.INFO)
# # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# #######################################
Expand Down Expand Up @@ -1677,7 +1671,7 @@
#class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(record)
# return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
# return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)
#
##### --------------start : my_error.py --------------
#class MyError(Exception):
Expand Down Expand Up @@ -1942,11 +1936,8 @@
#
##### --------------start : do_upgrade_pre.py--------------
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# logger = logging.getLogger('')
# logger.setLevel(logging.INFO)
# # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# #######################################
Expand Down Expand Up @@ -2492,7 +2483,7 @@
#class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(record)
# return re.sub(r'password="(?:[^"\\]|\\.)+"', 'password="******"', s)
# return re.sub(r'password="(?:[^"\\]|\\.)*"', 'password="******"', s)
#
##### --------------start : my_error.py --------------
#class MyError(Exception):
Expand Down Expand Up @@ -2739,11 +2730,8 @@
#
##### --------------start : do_upgrade_pre.py--------------
#def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# logger = logging.getLogger('')
# logger.setLevel(logging.INFO)
# # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# #######################################
Expand Down

0 comments on commit 92546c1

Please sign in to comment.