This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 863190ea29 [INLONG-10290][Manager] Prohibit groups that have not been
successfully configured from obtaining dataproxy addresses (#10293)
863190ea29 is described below
commit 863190ea29c353a9c33647e20d8be25e19544ae4
Author: fuweng11 <[email protected]>
AuthorDate: Wed May 29 12:47:09 2024 +0800
[INLONG-10290][Manager] Prohibit groups that have not been successfully
configured from obtaining dataproxy addresses (#10293)
---
.../inlong/manager/service/cluster/InlongClusterServiceImpl.java | 8 ++++++++
.../java/org/apache/inlong/manager/service/ServiceBaseTest.java | 2 ++
2 files changed, 10 insertions(+)
diff --git
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java
index 206102f1e1..4f7589e181 100644
---
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java
+++
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java
@@ -1210,6 +1210,14 @@ public class InlongClusterServiceImpl implements
InlongClusterService {
public DataProxyNodeResponse getDataProxyNodes(String groupId, String
protocolType) {
LOGGER.debug("begin to get data proxy nodes for groupId={},
protocol={}", groupId, protocolType);
+ InlongGroupEntity groupEntity = groupMapper.selectByGroupId(groupId);
+ GroupStatus groupStatus = GroupStatus.forCode(groupEntity.getStatus());
+ if (!Objects.equals(groupStatus, GroupStatus.CONFIG_SUCCESSFUL)) {
+ String errMsg =
+ String.format("current group status=%s was not allowed to
get data proxy nodes", groupStatus);
+ LOGGER.warn(errMsg);
+ throw new BusinessException(errMsg);
+ }
List<InlongClusterNodeEntity> nodeEntities = getClusterNodes(groupId,
ClusterType.DATAPROXY, protocolType);
DataProxyNodeResponse response = new DataProxyNodeResponse();
if (CollectionUtils.isEmpty(nodeEntities)) {
diff --git
a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/ServiceBaseTest.java
b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/ServiceBaseTest.java
index 27bed28ac8..b612767356 100644
---
a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/ServiceBaseTest.java
+++
b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/ServiceBaseTest.java
@@ -111,6 +111,8 @@ public class ServiceBaseTest extends BaseTest {
InlongGroupInfo updateGroupInfo = groupService.get(inlongGroupId);
groupService.updateStatus(inlongGroupId,
GroupStatus.TO_BE_APPROVAL.getCode(), GLOBAL_OPERATOR);
groupService.updateStatus(inlongGroupId,
GroupStatus.APPROVE_PASSED.getCode(), GLOBAL_OPERATOR);
+ groupService.updateStatus(inlongGroupId,
GroupStatus.CONFIG_ING.getCode(), GLOBAL_OPERATOR);
+ groupService.updateStatus(inlongGroupId,
GroupStatus.CONFIG_SUCCESSFUL.getCode(), GLOBAL_OPERATOR);
groupService.update(updateGroupInfo.genRequest(), GLOBAL_OPERATOR);
return groupInfo;