Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): 变更SQL支持业务强制审批设置 #7138 #7139

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading