ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-12547. There is no easy way to start all host components on a host via the API.(vbrodetskyi)
Date Mon, 27 Jul 2015 10:21:54 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 819ab1049 -> 01054f76d


AMBARI-12547. There is no easy way to start all host components on a host via the API.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/01054f76
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/01054f76
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/01054f76

Branch: refs/heads/trunk
Commit: 01054f76df4fafc44cfb1b326e74f7d645a2788f
Parents: 819ab10
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Mon Jul 27 13:20:11 2015 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Mon Jul 27 13:21:38 2015 +0300

----------------------------------------------------------------------
 .../controller/internal/HostComponentResourceProvider.java   | 8 ++++++++
 .../server/controller/AmbariManagementControllerTest.java    | 4 ++--
 .../internal/HostComponentResourceProviderTest.java          | 1 +
 3 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/01054f76/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
index d7fc33b..af39076 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
@@ -554,6 +554,14 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
         continue;
       }
 
+      // STARTED state is invalid for the client component, but this shouldn't cancel the
whole stage
+      if (sc.isClientComponent() && newState == State.STARTED &&
+            !requestProperties.containsKey(sch.getServiceComponentName().toLowerCase()))
{
+        ignoredScHosts.add(sch);
+        logComponentInfo("Ignoring ServiceComponentHost", request, sch.getState(), newState);
+        continue;
+      }
+
       if (sc.isClientComponent() &&
           !newState.isValidClientComponentState()) {
         throw new IllegalArgumentException("Invalid desired state for a client"

http://git-wip-us.apache.org/repos/asf/ambari/blob/01054f76/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 46dbb8e..599a1f7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -3723,9 +3723,9 @@ public class AmbariManagementControllerTest {
       reqs.add(req4);
       reqs.add(req5);
       updateHostComponents(reqs, Collections.<String, String>emptyMap(), true);
-      fail("Expected failure for invalid states");
+      // Expected, now client components with STARTED status will be ignored
     } catch (Exception e) {
-      // Expected
+      fail("Failure for invalid states");
     }
 
     reqs.clear();

http://git-wip-us.apache.org/repos/asf/ambari/blob/01054f76/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
index c38b142..734bbc4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
@@ -450,6 +450,7 @@ public class HostComponentResourceProviderTest {
         new TestHostComponentResourceProvider(PropertyHelper.getPropertyIds(type),
             PropertyHelper.getKeyPropertyIds(type),
             controller, injector);
+
     provider.setFieldValue("maintenanceStateHelper", injector.getInstance(MaintenanceStateHelper.class));
     provider.setFieldValue("hostVersionDAO", injector.getInstance(HostVersionDAO.class));
 


Mime
View raw message