Skip to content

Commit

Permalink
fix: 修复逻辑错误 TencentBlueKing#7545
Browse files Browse the repository at this point in the history
  • Loading branch information
guohelu committed Nov 13, 2024
1 parent 1d63db0 commit 7252ff6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,6 @@ def check_engine_admin_permission(request, *args, **kwargs):
print(f"BROKER_URL: {BROKER_URL}")

# bk_chat通知渠道
ENABLE_BK_CHAT_CHANNEL = True if env.ENABLE_BK_CHAT_CHANNEL else False
ENABLE_BK_CHAT_CHANNEL = env.ENABLE_BK_CHAT_CHANNEL
# bk_chat路由
BK_CHAT_ROUTE = env.BK_CHAT_ROUTE
9 changes: 4 additions & 5 deletions gcloud/shortcuts/message/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,16 @@ def send_task_flow_message(taskflow, msg_type, node_name=""):
title, content, email_content = title_and_content_for_atom_failed(
taskflow, taskflow.pipeline_instance, node_name, executor
)
notify_type = notify_types.get("fail", [])
# 如果有额外通知渠道,则将其与默认通知渠道进行拼接统一处理,如{'success': ['rtx'], 'data': [{'bk_chat':'xxx'}]}
notify_type = notify_types.get("fail", []) + notify_types.get("data")
elif msg_type == "task_finished":
title, content, email_content = title_and_content_for_flow_finished(
taskflow, taskflow.pipeline_instance, node_name, executor
)
notify_type = notify_types.get("success", [])
# 如果有额外通知渠道,则将其与默认通知渠道进行拼接统一处理,如{'fail': ['rtx'], 'data': [{'bk_chat':'xxx'}]}
notify_type = notify_types.get("success", []) + notify_types.get("data")
else:
return False
# 如果有额外通知渠道,则将其与默认通知渠道进行拼接统一处理,如{'success': ['rtx'], 'data': [{'bk_chat':'xxx'}]}
if notify_types.get("data", []):
notify_type += notify_types.get("data")
logger.info(
"taskflow[id={flow_id}] will send {msg_type} message({notify_type}) to: {receivers}".format(
flow_id=taskflow.id, msg_type=msg_type, notify_type=notify_type, receivers=receivers
Expand Down
4 changes: 2 additions & 2 deletions gcloud/shortcuts/message/send_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ def send(self, executor, notify_type, receivers, title, content, email_content=N

return True

def send_bkchat(self, notify, email_content=None):
def send_bkchat(self, notify, content=None):
params = {"bk_app_code": settings.APP_CODE, "bk_app_secret": settings.SECRET_KEY}

data = {
"im": "WEWORK",
"msg_type": "text",
"msg_param": {"content": email_content},
"msg_param": {"content": content},
"receiver": {"receiver_type": "group", "receiver_ids": [notify.get("bk_chat")]},
}

Expand Down

0 comments on commit 7252ff6

Please sign in to comment.