You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by sm...@apache.org on 2023/06/02 12:46:02 UTC

[knox] branch master updated: KNOX-2909 - Ignoring CORE_SETTINGS CM service discovery (#758)

This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ed96ecc0 KNOX-2909 - Ignoring CORE_SETTINGS CM service discovery (#758)
5ed96ecc0 is described below

commit 5ed96ecc04c27dea41c21bfce12929c1c29ccd79
Author: Sandor Molnar <sm...@apache.org>
AuthorDate: Fri Jun 2 14:45:56 2023 +0200

    KNOX-2909 - Ignoring CORE_SETTINGS CM service discovery (#758)
---
 .../topology/discovery/cm/ClouderaManagerServiceDiscovery.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscovery.java b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscovery.java
index 016b9467a..f503771a5 100644
--- a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscovery.java
+++ b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscovery.java
@@ -74,6 +74,7 @@ public class ClouderaManagerServiceDiscovery implements ServiceDiscovery, Cluste
 
   public static final String CM_SERVICE_TYPE  = "CM";
   public static final String CM_ROLE_TYPE  = "CM_SERVER";
+  public static final String CORE_SETTINGS_TYPE = "CORE_SETTINGS";
 
   private ServiceModelGeneratorsHolder serviceModelGeneratorsHolder = ServiceModelGeneratorsHolder.getInstance();
 
@@ -273,8 +274,8 @@ public class ClouderaManagerServiceDiscovery implements ServiceDiscovery, Cluste
         }
         log.discoveringService(service.getName(), service.getType());
         ApiServiceConfig serviceConfig = null;
-        /* no reason to check service config for CM service */
-        if(!CM_SERVICE_TYPE.equals(service.getType())) {
+        /* no reason to check service config for CM or CORE_SETTINGS services */
+        if (!CM_SERVICE_TYPE.equals(service.getType()) && !CORE_SETTINGS_TYPE.equals(service.getType())) {
           serviceConfig = getServiceConfig(client.getConfig(), servicesResourceApi, service);
         }
         ApiRoleList roleList = getRoles(client.getConfig(), rolesResourceApi, clusterName, service);
@@ -382,13 +383,13 @@ public class ClouderaManagerServiceDiscovery implements ServiceDiscovery, Cluste
       try {
         log.lookupRolesFromCM();
         /* Populate roles for CM Service since they are not discoverable */
-        if(CM_SERVICE_TYPE.equalsIgnoreCase(serviceName)) {
+        if (CM_SERVICE_TYPE.equalsIgnoreCase(serviceName)) {
           roles = new ApiRoleList();
           final ApiRole cmRole = new ApiRole();
           cmRole.setName(CM_ROLE_TYPE);
           cmRole.setType(CM_ROLE_TYPE);
           roles.addItemsItem(cmRole);
-        } else {
+        } else if (!CORE_SETTINGS_TYPE.equalsIgnoreCase(serviceName)) { //CORE_SETTINGS has no roles, it does not make sense to discover them
           roles = rolesResourceApi.readRoles(clusterName, serviceName, "", VIEW_SUMMARY);
         }