Closes #20088: Remove model from webhook context (replaced by object_type) (#20325)
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Has been cancelled
CI / build (20.x, 3.12) (push) Has been cancelled
CI / build (20.x, 3.13) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled

This commit is contained in:
Jeremy Stretch
2025-09-12 12:54:54 -04:00
committed by GitHub
parent cfcea7c941
commit b9567208d4
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -363,7 +363,7 @@ class EventRuleTest(APITestCase):
body = json.loads(request.body)
self.assertEqual(body['event'], 'created')
self.assertEqual(body['timestamp'], job.kwargs['timestamp'])
self.assertEqual(body['model'], 'site')
self.assertEqual(body['object_type'], 'dcim.site')
self.assertEqual(body['username'], 'testuser')
self.assertEqual(body['request_id'], str(request_id))
self.assertEqual(body['data']['name'], 'Site 1')
+1 -2
View File
@@ -52,7 +52,6 @@ def send_webhook(event_rule, object_type, event_type, data, timestamp, username,
'event': WEBHOOK_EVENT_TYPES.get(event_type, event_type),
'timestamp': timestamp,
'object_type': '.'.join(object_type.natural_key()),
'model': object_type.model,
'username': username,
'request_id': request.id if request else None,
'data': data,
@@ -100,7 +99,7 @@ def send_webhook(event_rule, object_type, event_type, data, timestamp, username,
'data': body.encode('utf8'),
}
logger.info(
f"Sending {params['method']} request to {params['url']} ({context['model']} {context['event']})"
f"Sending {params['method']} request to {params['url']} ({context['object_type']} {context['event']})"
)
logger.debug(params)
try: