fix wehook trigger ok when http status failed (#718)

Co-authored-by: tangshoubin <tangshoubin@itiger.com>
This commit is contained in:
tangr
2025-09-04 15:25:58 +08:00
committed by GitHub
parent 99aea57948
commit bdf9bc576c
2 changed files with 5 additions and 2 deletions

View File

@@ -255,7 +255,9 @@ def cmdb_trigger():
try:
ready_cis = CITriggerManager.waiting_cis(trigger)
except Exception as e:
print(e)
import traceback
current_app.logger.error("cmdb trigger waiting_cis exception for trigger_id {}: {}".format(trigger.id, e))
current_app.logger.error("traceback: {}".format(traceback.format_exc()))
continue
if trigger.id not in trigger2cis:

View File

@@ -1618,7 +1618,8 @@ class CITriggerManager(object):
ci_id, need_children=False, use_master=False, enum_use_label=True)
try:
response = webhook_request(webhook, ci_dict).text
response = webhook_request(webhook, ci_dict)
response.raise_for_status()
is_ok = True
except Exception as e:
current_app.logger.warning("exec webhook failed: {}".format(e))