Skip to content

Commit

Permalink
fix(backend): 变更SQL支持业务强制审批设置 #7138
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Sep 26, 2024
1 parent f84b91a commit 8676f0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions dbm-ui/backend/configuration/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class BizSettingsEnum(str, StructuredEnum):
INDEPENDENT_HOSTING_DB_TYPES = EnumField("INDEPENDENT_HOSTING_DB_TYPES", _("独立托管机器的数据库类型"))
# TODO: 后续待删除
SKIP_GRAMMAR_CHECK = EnumField("SKIP_GRAMMAR_CHECK", _("是否跳过语义检查"))
SQL_IMPORT_FORCE_ITSM = EnumField("SQL_IMPORT_FORCE_ITSM", _("是否变更SQL强制需要审批流"))


DEFAULT_DB_ADMINISTRATORS = ["admin"]
Expand Down
7 changes: 6 additions & 1 deletion dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

from backend import env
from backend.components.sql_import.client import SQLSimulationApi
from backend.configuration.constants import DBType
from backend.configuration.constants import BizSettingsEnum, DBType
from backend.configuration.models import BizSettings
from backend.db_services.mysql.sql_import.constants import SQLExecuteTicketMode
from backend.db_services.mysql.sql_import.handlers import SQLHandler
from backend.flow.engine.bamboo.engine import BambooEngine
Expand Down Expand Up @@ -113,6 +114,10 @@ class MysqlSqlImportFlowBuilder(BaseMySQLTicketFlowBuilder):

@property
def need_itsm(self):
# 业务强制需要审批流
force_need_itsm = BizSettings.get_setting_value(self.ticket.bk_biz_id, BizSettingsEnum.SQL_IMPORT_FORCE_ITSM)
if force_need_itsm:
return True
# 非高危的SQL变更单据,不需要审批节点
grammar_check_info = self.ticket.details["grammar_check_info"].values()
high_risk = [check["highrisk_warnings"] for check in grammar_check_info if check["highrisk_warnings"]]
Expand Down

0 comments on commit 8676f0c

Please sign in to comment.