Skip to content

Commit bdf9bc5

Browse files
tangrtangshoubin
andauthored
fix wehook trigger ok when http status failed (#718)
Co-authored-by: tangshoubin <[email protected]>
1 parent 99aea57 commit bdf9bc5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmdb-api/api/commands/click_cmdb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@ def cmdb_trigger():
255255
try:
256256
ready_cis = CITriggerManager.waiting_cis(trigger)
257257
except Exception as e:
258-
print(e)
258+
import traceback
259+
current_app.logger.error("cmdb trigger waiting_cis exception for trigger_id {}: {}".format(trigger.id, e))
260+
current_app.logger.error("traceback: {}".format(traceback.format_exc()))
259261
continue
260262

261263
if trigger.id not in trigger2cis:

cmdb-api/api/lib/cmdb/ci.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,8 @@ def _exec_webhook(cls, operate_type, webhook, ci_dict, trigger_id, trigger_name,
16181618
ci_id, need_children=False, use_master=False, enum_use_label=True)
16191619

16201620
try:
1621-
response = webhook_request(webhook, ci_dict).text
1621+
response = webhook_request(webhook, ci_dict)
1622+
response.raise_for_status()
16221623
is_ok = True
16231624
except Exception as e:
16241625
current_app.logger.warning("exec webhook failed: {}".format(e))

0 commit comments

Comments
 (0)