You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2018/05/15 12:21:40 UTC
[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-23746.
Host components request fails due to missing component ID (#1265)
This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by this push:
new 753f41d AMBARI-23746. Host components request fails due to missing component ID (#1265)
753f41d is described below
commit 753f41dfc01b9fcf698c684c7b96807e191e10d6
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Tue May 15 14:21:37 2018 +0200
AMBARI-23746. Host components request fails due to missing component ID (#1265)
---
.../controller/AmbariManagementControllerImpl.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index d244358..f601c83 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -242,9 +242,11 @@ import org.apache.http.client.utils.URIBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Strings;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -1396,6 +1398,16 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
}
+ if (request.getComponentId() != null) {
+ Service service = cluster.getServiceByComponentId(request.getComponentId());
+ if (Strings.isNullOrEmpty(request.getServiceGroupName())) {
+ request.setServiceGroupName(service.getServiceGroupName());
+ }
+ if (Strings.isNullOrEmpty(request.getServiceName())) {
+ request.setServiceName(service.getName());
+ }
+ }
+
if (request.getComponentName() != null) {
if (StringUtils.isBlank(request.getServiceName())) {
@@ -1418,12 +1430,13 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
}
- request.setServiceGroupName(cluster.getServiceByComponentId(request.getComponentId()).getServiceGroupName());
- List<Service> services = new ArrayList<>();
- if (request.getServiceName() != null && !request.getServiceName().isEmpty()) {
- services.add(cluster.getService(request.getServiceName()));
+ List<Service> services;
+ if (!Strings.isNullOrEmpty(request.getServiceName())) {
+ services = ImmutableList.of(cluster.getService(request.getServiceName()));
+ } else if (!Strings.isNullOrEmpty(request.getServiceGroupName())) {
+ services = ImmutableList.copyOf(cluster.getServicesByServiceGroup(request.getServiceGroupName()));
} else {
- services.addAll(cluster.getServicesByServiceGroup(request.getServiceGroupName()));
+ services = ImmutableList.copyOf(cluster.getServices().values());
}
Set<ServiceComponentHostResponse> response =
--
To stop receiving notification emails like this one, please contact
adoroszlai@apache.org.