This is an automated email from the ASF dual-hosted git repository.
sureshanaparti pushed a commit to branch 4.20
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.20 by this push:
new cda3640be15 juniper-contrail: publish events only for the module
(#11373)
cda3640be15 is described below
commit cda3640be1590da60ecd3e1bd11a9899ca655416
Author: Abhishek Kumar <[email protected]>
AuthorDate: Mon Aug 4 16:37:32 2025 +0530
juniper-contrail: publish events only for the module (#11373)
* juniper-contrail: publish events only for the module
This plugin has an ActionEventInterceptor of its own and currently it
intercepts all action events which is incorrect as all action events are
already handled by com.cloud.event.ActionEventInterceptor.
This PR limits publishing events on event bus by plugin's interceptor
only in case the event is from the same module.
Existing behaviour was causing warnings in Webhook service as event
account was missing.
2025-07-31 19:18:59,391 WARN [o.a.c.m.w.WebhookServiceImpl] ... to any
webhook as account ID is missing
Signed-off-by: Abhishek Kumar <[email protected]>
---
.../cloudstack/network/contrail/management/EventUtils.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git
a/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/EventUtils.java
b/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/EventUtils.java
index d47bf6eceeb..338caca1fbe 100644
---
a/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/EventUtils.java
+++
b/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/EventUtils.java
@@ -48,6 +48,10 @@ public class EventUtils {
private static EventDistributor eventDistributor;
+ private static final String MODULE_TOP_LEVEL_PACKAGE =
+ EventUtils.class.getPackage().getName().substring(0,
+ EventUtils.class.getPackage().getName().lastIndexOf('.'));
+
public EventUtils() {
}
@@ -143,6 +147,13 @@ public class EventUtils {
@Override
public void interceptComplete(Method method, Object target, Object
event) {
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
+ boolean sameModule = false;
+ if (target != null && target.getClass().getPackage() != null) {
+ sameModule =
target.getClass().getPackage().getName().startsWith(MODULE_TOP_LEVEL_PACKAGE);
+ }
+ if (!sameModule) {
+ return;
+ }
if (actionEvent != null) {
CallContext ctx = CallContext.current();
if (!actionEvent.create()) {