Fix the upgrade script when password is less than 6 characters

This commit is contained in:
obdev
2024-06-20 13:45:21 +00:00
committed by ob-robot
parent 1169ba55de
commit 92546c111b
6 changed files with 36 additions and 72 deletions

View File

@ -26,14 +26,11 @@ class UpgradeParams:
class PasswordMaskingFormatter(logging.Formatter): class PasswordMaskingFormatter(logging.Formatter):
def format(self, record): def format(self, record):
s = super(PasswordMaskingFormatter, self).format(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): def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\ logger = logging.getLogger('')
format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ logger.setLevel(logging.INFO)
datefmt='%Y-%m-%d %H:%M:%S',\
filename=log_filenamme,\
filemode='w')
# 定义日志打印格式 # 定义日志打印格式
formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
####################################### #######################################

View File

@ -25,14 +25,11 @@ class UpgradeParams:
class PasswordMaskingFormatter(logging.Formatter): class PasswordMaskingFormatter(logging.Formatter):
def format(self, record): def format(self, record):
s = super(PasswordMaskingFormatter, self).format(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): def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\ logger = logging.getLogger('')
format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ logger.setLevel(logging.INFO)
datefmt='%Y-%m-%d %H:%M:%S',\
filename=log_filenamme,\
filemode='w')
# 定义日志打印格式 # 定义日志打印格式
formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
####################################### #######################################

View File

@ -17,7 +17,7 @@ class UpgradeParams:
class PasswordMaskingFormatter(logging.Formatter): class PasswordMaskingFormatter(logging.Formatter):
def format(self, record): def format(self, record):
s = super(PasswordMaskingFormatter, self).format(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 -------------- #### --------------start : my_error.py --------------
class MyError(Exception): class MyError(Exception):
@ -282,11 +282,8 @@ def get_opt_log_file():
#### --------------start : do_upgrade_pre.py-------------- #### --------------start : do_upgrade_pre.py--------------
def config_logging_module(log_filenamme): def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\ logger = logging.getLogger('')
format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ logger.setLevel(logging.INFO)
datefmt='%Y-%m-%d %H:%M:%S',\
filename=log_filenamme,\
filemode='w')
# 定义日志打印格式 # 定义日志打印格式
formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
####################################### #######################################

View File

@ -16,7 +16,7 @@ class UpgradeParams:
class PasswordMaskingFormatter(logging.Formatter): class PasswordMaskingFormatter(logging.Formatter):
def format(self, record): def format(self, record):
s = super(PasswordMaskingFormatter, self).format(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 -------------- #### --------------start : my_error.py --------------
class MyError(Exception): class MyError(Exception):
@ -263,11 +263,8 @@ def get_opt_zone():
#### --------------start : do_upgrade_pre.py-------------- #### --------------start : do_upgrade_pre.py--------------
def config_logging_module(log_filenamme): def config_logging_module(log_filenamme):
logging.basicConfig(level=logging.INFO,\ logger = logging.getLogger('')
format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ logger.setLevel(logging.INFO)
datefmt='%Y-%m-%d %H:%M:%S',\
filename=log_filenamme,\
filemode='w')
# 定义日志打印格式 # 定义日志打印格式
formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
####################################### #######################################

View File

@ -626,14 +626,11 @@
#class PasswordMaskingFormatter(logging.Formatter): #class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record): # def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(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): #def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\ # logger = logging.getLogger('')
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ # logger.setLevel(logging.INFO)
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# # 定义日志打印格式 # # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') # formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# ####################################### # #######################################
@ -798,14 +795,11 @@
#class PasswordMaskingFormatter(logging.Formatter): #class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record): # def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(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): #def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\ # logger = logging.getLogger('')
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ # logger.setLevel(logging.INFO)
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# # 定义日志打印格式 # # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') # formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# ####################################### # #######################################
@ -1677,7 +1671,7 @@
#class PasswordMaskingFormatter(logging.Formatter): #class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record): # def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(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 -------------- ##### --------------start : my_error.py --------------
#class MyError(Exception): #class MyError(Exception):
@ -1942,11 +1936,8 @@
# #
##### --------------start : do_upgrade_pre.py-------------- ##### --------------start : do_upgrade_pre.py--------------
#def config_logging_module(log_filenamme): #def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\ # logger = logging.getLogger('')
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ # logger.setLevel(logging.INFO)
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# # 定义日志打印格式 # # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') # formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# ####################################### # #######################################
@ -2492,7 +2483,7 @@
#class PasswordMaskingFormatter(logging.Formatter): #class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record): # def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(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 -------------- ##### --------------start : my_error.py --------------
#class MyError(Exception): #class MyError(Exception):
@ -2739,11 +2730,8 @@
# #
##### --------------start : do_upgrade_pre.py-------------- ##### --------------start : do_upgrade_pre.py--------------
#def config_logging_module(log_filenamme): #def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\ # logger = logging.getLogger('')
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ # logger.setLevel(logging.INFO)
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# # 定义日志打印格式 # # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') # formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# ####################################### # #######################################

View File

@ -626,14 +626,11 @@
#class PasswordMaskingFormatter(logging.Formatter): #class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record): # def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(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): #def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\ # logger = logging.getLogger('')
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ # logger.setLevel(logging.INFO)
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# # 定义日志打印格式 # # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') # formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# ####################################### # #######################################
@ -798,14 +795,11 @@
#class PasswordMaskingFormatter(logging.Formatter): #class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record): # def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(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): #def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\ # logger = logging.getLogger('')
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ # logger.setLevel(logging.INFO)
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# # 定义日志打印格式 # # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') # formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# ####################################### # #######################################
@ -1677,7 +1671,7 @@
#class PasswordMaskingFormatter(logging.Formatter): #class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record): # def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(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 -------------- ##### --------------start : my_error.py --------------
#class MyError(Exception): #class MyError(Exception):
@ -1942,11 +1936,8 @@
# #
##### --------------start : do_upgrade_pre.py-------------- ##### --------------start : do_upgrade_pre.py--------------
#def config_logging_module(log_filenamme): #def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\ # logger = logging.getLogger('')
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ # logger.setLevel(logging.INFO)
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# # 定义日志打印格式 # # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') # formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# ####################################### # #######################################
@ -2492,7 +2483,7 @@
#class PasswordMaskingFormatter(logging.Formatter): #class PasswordMaskingFormatter(logging.Formatter):
# def format(self, record): # def format(self, record):
# s = super(PasswordMaskingFormatter, self).format(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 -------------- ##### --------------start : my_error.py --------------
#class MyError(Exception): #class MyError(Exception):
@ -2739,11 +2730,8 @@
# #
##### --------------start : do_upgrade_pre.py-------------- ##### --------------start : do_upgrade_pre.py--------------
#def config_logging_module(log_filenamme): #def config_logging_module(log_filenamme):
# logging.basicConfig(level=logging.INFO,\ # logger = logging.getLogger('')
# format='[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s',\ # logger.setLevel(logging.INFO)
# datefmt='%Y-%m-%d %H:%M:%S',\
# filename=log_filenamme,\
# filemode='w')
# # 定义日志打印格式 # # 定义日志打印格式
# formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S') # formatter = PasswordMaskingFormatter('[%(asctime)s] %(levelname)s %(filename)s:%(lineno)d %(message)s', '%Y-%m-%d %H:%M:%S')
# ####################################### # #######################################