You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2017/11/22 08:45:09 UTC

[1/7] ambari git commit: AMBARI-22468 : enabling hdfs and hive ranger plugin fails (mradhakrishnan)

Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-22457 58c7f784a -> c7457a820


AMBARI-22468 : enabling hdfs and hive ranger plugin fails (mradhakrishnan)


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

Branch: refs/heads/branch-feature-AMBARI-22457
Commit: a1d59b7dde13b8e3cad5a1e1687911ca4afc340b
Parents: c09c69b
Author: Madhuvanthi Radhakrishnan <mr...@hortonworks.com>
Authored: Fri Nov 17 12:39:07 2017 -0800
Committer: Madhuvanthi Radhakrishnan <mr...@hortonworks.com>
Committed: Fri Nov 17 12:40:21 2017 -0800

----------------------------------------------------------------------
 .../resources/stacks/HDP/2.6/services/stack_advisor.py   | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a1d59b7d/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
index a16fdb7..a5f54a3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
@@ -66,11 +66,12 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
     if storm_env and storm_site and security_enabled and 'STREAMLINE' in servicesList:
       storm_nimbus_impersonation_acl = storm_site["nimbus.impersonation.acl"] if "nimbus.impersonation.acl" in storm_site else None
       streamline_env = self.getServicesSiteProperties(services, "streamline-env")
-      _streamline_principal_name = streamline_env['streamline_principal_name'] if 'streamline_principal_name' in streamline_env else None
-      if _streamline_principal_name is not None and storm_nimbus_impersonation_acl is not None:
-        streamline_bare_principal = get_bare_principal(_streamline_principal_name)
-        storm_nimbus_impersonation_acl.replace('{{streamline_bare_principal}}', streamline_bare_principal)
-        putStormSiteProperty('nimbus.impersonation.acl', storm_nimbus_impersonation_acl)
+      if streamline_env:
+        _streamline_principal_name = streamline_env['streamline_principal_name'] if 'streamline_principal_name' in streamline_env else None
+        if _streamline_principal_name is not None and storm_nimbus_impersonation_acl is not None:
+          streamline_bare_principal = get_bare_principal(_streamline_principal_name)
+          storm_nimbus_impersonation_acl.replace('{{streamline_bare_principal}}', streamline_bare_principal)
+          putStormSiteProperty('nimbus.impersonation.acl', storm_nimbus_impersonation_acl)
       
       storm_nimbus_autocred_plugin_classes = storm_site["nimbus.autocredential.plugins.classes"] if "nimbus.autocredential.plugins.classes" in storm_site else None
       if storm_nimbus_autocred_plugin_classes is not None:


[4/7] ambari git commit: AMBARI-22337 each service should be able to implement server actions, package them add a jar to be loaded during EU (port from trunk to branch-26)(dili)

Posted by ao...@apache.org.
AMBARI-22337 each service should be able to implement server actions, package them add a jar to be loaded during EU (port from trunk to branch-26)(dili)


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

Branch: refs/heads/branch-feature-AMBARI-22457
Commit: eecd8513a304641617cc8602f5805eee8aaf3c69
Parents: 17f89c0
Author: Di Li <di...@apache.org>
Authored: Mon Nov 20 13:54:31 2017 -0500
Committer: Di Li <di...@apache.org>
Committed: Mon Nov 20 13:54:31 2017 -0500

----------------------------------------------------------------------
 ambari-server/pom.xml                           |  12 ++
 .../serveraction/ServerActionExecutor.java      | 147 +++++++++++++++++--
 .../ambari/server/stack/ServiceDirectory.java   |  29 ++++
 .../ambari/server/stack/ServiceModule.java      |   8 +
 .../apache/ambari/server/state/ServiceInfo.java |  14 ++
 .../ambari/server/stack/ServiceModuleTest.java  |  30 ++++
 .../server/stack/StackManagerExtensionTest.java |   6 +
 7 files changed, 232 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/eecd8513/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 342b3c0..eece739 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -165,6 +165,18 @@
               </target>
             </configuration>
           </execution>
+          <execution>
+            <id>generate-test-oozie2-server-actions-dir</id>
+            <phase>process-test-classes</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target>
+                <mkdir dir="target/test-classes/extensions/EXT/0.1/services/OOZIE2/server_actions/tmp"/>
+              </target>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
       <plugin>

http://git-wip-us.apache.org/repos/asf/ambari/blob/eecd8513/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
index 50e3cfe..e219dc3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
@@ -18,10 +18,17 @@
 
 package org.apache.ambari.server.serveraction;
 
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.StringTokenizer;
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.ConcurrentHashMap;
@@ -38,11 +45,17 @@ import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.actionmanager.Stage;
 import org.apache.ambari.server.agent.CommandReport;
 import org.apache.ambari.server.agent.ExecutionCommand;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.security.authorization.internal.InternalAuthenticationToken;
+import org.apache.ambari.server.state.ServiceInfo;
+import org.apache.ambari.server.state.UpgradeContext.UpgradeServiceSummary;
+import org.apache.ambari.server.state.UpgradeContext.UpgradeSummary;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.util.ClassUtils;
 
 import com.google.inject.Inject;
 import com.google.inject.Injector;
@@ -495,7 +508,6 @@ public class ServerActionExecutor {
         throw new AmbariException("Missing ExecutionCommand data");
       } else {
         Map<String, String> roleParams = executionCommand.getRoleParams();
-
         if (roleParams == null) {
           throw new AmbariException("Missing RoleParams data");
         } else {
@@ -504,8 +516,30 @@ public class ServerActionExecutor {
           if (actionClassname == null) {
             throw new AmbariException("Missing action classname for server action");
           } else {
-            ServerAction action = createServerAction(actionClassname);
-
+            Map<String, ServiceInfo> services = new HashMap<String, ServiceInfo>();
+            UpgradeSummary upgradeSummary = executionCommand.getUpgradeSummary();
+            if (upgradeSummary != null) {
+              Map<String, UpgradeServiceSummary> upgradeServiceSummaries = upgradeSummary.services;
+              LOG.debug("UpgradeServiceSummary: " + upgradeServiceSummaries);
+              AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
+              AmbariMetaInfo ambariMetaInfo = ambariManagementController.getAmbariMetaInfo();
+              String serviceName = executionCommand.getServiceName();
+              if (serviceName != null && !serviceName.isEmpty()){
+                LOG.info(String.format("Server action %s is associated with service %s", actionClassname, serviceName));
+                //Execution stage of a given service, only need to examine stack information for this one service
+                UpgradeServiceSummary serviceSummary = upgradeServiceSummaries.get(serviceName);
+                addServiceInfo(services, ambariMetaInfo, serviceSummary.sourceStackId, serviceName);
+              } else {
+                LOG.info(String.format("Server action %s is not associated with a service", actionClassname));
+                //Load all Jars
+                for(String key: upgradeServiceSummaries.keySet()){
+                  UpgradeServiceSummary serviceSummary = upgradeServiceSummaries.get(key);
+                  addServiceInfo(services, ambariMetaInfo, serviceSummary.sourceStackId, key);
+                }
+              }
+              LOG.info(String.format("Attempt to load server action classes from %s", services.keySet().toString()));
+            }
+            ServerAction action = createServerAction(actionClassname, services);
             if (action == null) {
               throw new AmbariException("Failed to create server action: " + actionClassname);
             } else {
@@ -520,6 +554,30 @@ public class ServerActionExecutor {
       }
     }
 
+    private void addServiceInfo(Map<String, ServiceInfo> services, AmbariMetaInfo ambariMetaInfo, String stackId, String serviceName) {
+      List<String> stackInfo = getStackInfo(stackId);
+      LOG.debug(String.format("Stack info list: %s", stackInfo));
+      if (stackInfo.size() > 1) {
+        try {
+          ServiceInfo service = ambariMetaInfo.getService(stackInfo.get(0), stackInfo.get(1), serviceName);
+          LOG.debug(String.format("Adding %s to the list of services for loading external Jars...", service.getName()));
+          services.put(serviceName, service);
+        } catch (AmbariException e) {
+          LOG.error(String.format("Failed to obtain service info for stack %s, service name %s", stackId, serviceName), e);
+        }
+      }
+    }
+
+    private List<String> getStackInfo(String stackId) {
+      LOG.debug(String.format("Stack id: %s", stackId));
+      StringTokenizer tokens = new StringTokenizer(stackId, "-");
+      List<String> info = new ArrayList<String>();
+      while (tokens.hasMoreElements()) {
+        info.add((String)tokens.nextElement());
+      }
+      return info;
+    }
+
     /**
      * Attempts to create an instance of the ServerAction class implementation specified in
      * classname.
@@ -528,24 +586,85 @@ public class ServerActionExecutor {
      * @return the instantiated ServerAction implementation
      * @throws AmbariException
      */
-    private ServerAction createServerAction(String classname) throws AmbariException {
-      try {
-        Class<?> actionClass = Class.forName(classname);
+    private ServerAction createServerAction(String classname, Map<String, ServiceInfo> services) throws AmbariException {
+      Class<?> actionClass = null;
+      actionClass = getServerActionClass(classname);
+      if (actionClass == null) {
+        LOG.debug(String.format("Did not find %s in Ambari, try to load it from external directories", classname));
+        actionClass = getServiceLevelServerActionClass(classname, services);
+      }
 
-        if (actionClass == null) {
-          throw new AmbariException("Unable to load server action class: " + classname);
+      if (actionClass == null) {
+        throw new AmbariException("Unable to load server action class: " + classname);
+      } else {
+        LOG.debug(String.format("Ready to init server action %s", classname));
+        Class<? extends ServerAction> serverActionClass = actionClass.asSubclass(ServerAction.class);
+        if (serverActionClass == null) {
+          throw new AmbariException("Unable to execute server action class, invalid type: " + classname);
         } else {
-          Class<? extends ServerAction> serverActionClass = actionClass.asSubclass(ServerAction.class);
+          return injector.getInstance(serverActionClass);
+        }
+      }
+    }
 
-          if (serverActionClass == null) {
-            throw new AmbariException("Unable to execute server action class, invalid type: " + classname);
-          } else {
-            return injector.getInstance(serverActionClass);
+    /**
+     * Load server action classes defined in the service level Jar files
+     * */
+    private Class<?> getServiceLevelServerActionClass(String classname, Map<String, ServiceInfo> services) {
+      List<URL> urls = new ArrayList<>();
+      for (ServiceInfo service : services.values()) {
+        LOG.debug(String.format("Checking service %s", service));
+        File dir = service.getServerActionsFolder();
+        if ( dir != null) {
+          LOG.debug(String.format("Service %s, external dir %s",service.getName(), dir.getAbsolutePath()));
+          File[] jars = dir.listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+              LOG.debug(String.format("Checking folder %s", name));
+              return name.endsWith(".jar");
+            }
+          });
+          for (File jar : jars) {
+            try {
+              URL url = jar.toURI().toURL();
+              urls.add(url);
+              LOG.info("Adding server action jar to classpath: {}", url);
+            }
+            catch (Exception e) {
+              LOG.error("Failed to add server action jar to classpath: {}", jar.getAbsolutePath(), e);
+            }
           }
+        } else {
+          LOG.error(String.format("%s service server actions folder returned null", service));
+        }
+      }
+
+      ClassLoader classLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), ClassUtils.getDefaultClassLoader());
+      Class<?> actionClass = null;
+      try {
+        actionClass = ClassUtils.resolveClassName(classname, classLoader);
+        LOG.debug(String.format("Found external server action %s", classname));
+      } catch(IllegalArgumentException illegalArgumentException) {
+        LOG.error(String.format("Unable to find server action %s in external server action directories", classname), illegalArgumentException);
+      }
+
+      return actionClass;
+    }
+
+    /**
+     * Load server action classes defined in Ambari source code
+     * */
+    private Class<?> getServerActionClass(String classname) throws AmbariException{
+      Class<?> actionClass = null;
+      try {
+        actionClass = Class.forName(classname);
+        if (actionClass == null) {
+          LOG.warn(String.format("Unable to load server action class: %s from Ambari", classname));
         }
       } catch (ClassNotFoundException e) {
-        throw new AmbariException("Unable to load server action class: " + classname, e);
+        LOG.error(String.format("Unable to load server action class: %s", classname), e);
       }
+      return actionClass;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/eecd8513/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
index abef459..8af0c9a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
@@ -92,6 +92,11 @@ public abstract class ServiceDirectory extends StackDefinitionDirectory {
   protected File checksDir;
 
   /**
+   * server side action directory path
+   */
+  protected File serverActionsDir;
+
+  /**
    * service metainfo file object representation
    */
   private ServiceMetainfoXml metaInfoXml;
@@ -117,6 +122,11 @@ public abstract class ServiceDirectory extends StackDefinitionDirectory {
   protected static final String CHECKS_FOLDER_NAME = "checks";
 
   /**
+   * Server actions directory name
+   */
+  protected static final String SERVER_ACTIONS_FOLDER_NAME = "server_actions";
+
+  /**
    * service metainfo file name
    */
   private static final String SERVICE_METAINFO_FILE_NAME = "metainfo.xml";
@@ -171,6 +181,15 @@ public abstract class ServiceDirectory extends StackDefinitionDirectory {
   }
 
   /**
+   * Obtain the server side actions directory path.
+   *
+   * @return server side actions directory path
+   */
+  public File getServerActionsDir() {
+    return serverActionsDir;
+  }
+
+  /**
    * Obtain the metrics file.
    *
    * @return metrics file
@@ -302,6 +321,7 @@ public abstract class ServiceDirectory extends StackDefinitionDirectory {
 	  calculatePackageDirectory(stack, service);
 	  calculateUpgradesDirectory(stack, service);
 	  calculateChecksDirectory(stack, service);
+	  calculateServerActionsDirectory(stack, service);
   }
 
   /**
@@ -377,6 +397,15 @@ public abstract class ServiceDirectory extends StackDefinitionDirectory {
   }
 
   /**
+   * Sets the serverActionsDir if the dir exists and is not empty
+   * @param stack
+   * @param service
+   */
+  protected void calculateServerActionsDirectory(String stack, String service) {
+    serverActionsDir = resolveDirectory(SERVER_ACTIONS_FOLDER_NAME, stack, service);
+  }
+
+  /**
    * Unmarshal the metainfo file into its object representation.
    *
    * @throws AmbariException if the metainfo file doesn't exist or

http://git-wip-us.apache.org/repos/asf/ambari/blob/eecd8513/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
index 6699e0e..7a8fa64 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
@@ -144,6 +144,7 @@ public class ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implem
     serviceInfo.setServicePackageFolder(serviceDirectory.getPackageDir());
     serviceInfo.setServiceUpgradesFolder(serviceDirectory.getUpgradesDir());
     serviceInfo.setChecksFolder(serviceDirectory.getChecksDir());
+    serviceInfo.setServerActionsFolder(serviceDirectory.getServerActionsDir());
     serviceInfo.setAdvisorFile(serviceDirectory.getAdvisorFile());
     serviceInfo.setAdvisorName(serviceDirectory.getAdvisorName(serviceInfo.getName()));
 
@@ -259,6 +260,13 @@ public class ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implem
       serviceInfo.setChecksFolder(parent.getChecksFolder());
     }
 
+    /*
+     * Use parent's server actions if the current one does not have any.
+     */
+    if (serviceInfo.getServerActionsFolder() == null) {
+      serviceInfo.setServerActionsFolder(parent.getServerActionsFolder());
+    }
+
     /**
      * If current stack version does not specify the credential store information
      * for the service, then use parent definition.

http://git-wip-us.apache.org/repos/asf/ambari/blob/eecd8513/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
index b7afe53..a5ea449 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
@@ -282,6 +282,12 @@ public class ServiceInfo implements Validable{
   @XmlTransient
   private File checksFolder;
 
+  /**
+   * Stores the path to the server actions folder which contains server actions jars for the given service.
+   */
+  @XmlTransient
+  private File serverActionsFolder;
+
   public boolean isDeleted() {
     return isDeleted;
   }
@@ -744,6 +750,14 @@ public String getVersion() {
     this.checksFolder = checksFolder;
   }
 
+  public File getServerActionsFolder() {
+    return serverActionsFolder;
+  }
+
+  public void setServerActionsFolder(File serverActionsFolder) {
+    this.serverActionsFolder = serverActionsFolder;
+  }
+
   /**
    * Exposes (and initializes on first use) map of os-specific details.
    * @return  map of OS specific details keyed by family

http://git-wip-us.apache.org/repos/asf/ambari/blob/eecd8513/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java
index 5efbc89..f8bfac8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java
@@ -467,6 +467,36 @@ public class ServiceModuleTest {
   }
 
   @Test
+  public void testResolve_ServerActionDirectory() throws Exception {
+    File serverActions = new File("server_actions");
+
+    // check directory specified in child only
+    ServiceInfo info = new ServiceInfo();
+    ServiceInfo parentInfo = new ServiceInfo();
+    ServiceModule child = createServiceModule(info);
+    ServiceModule parent = createServiceModule(parentInfo);
+    child.getModuleInfo().setServerActionsFolder(serverActions);
+    resolveService(child, parent);
+    assertEquals(serverActions.getPath(), child.getModuleInfo().getServerActionsFolder().getPath());
+
+    // check directory specified in parent only
+    child = createServiceModule(info);
+    parent = createServiceModule(parentInfo);
+    parent.getModuleInfo().setServerActionsFolder(serverActions);
+    resolveService(child, parent);
+    assertEquals(serverActions.getPath(), child.getModuleInfo().getServerActionsFolder().getPath());
+
+    // check directory set in both
+    info.setServerActionsFolder(serverActions);
+    child = createServiceModule(info);
+    child.getModuleInfo().setServerActionsFolder(serverActions);
+    parent = createServiceModule(parentInfo);
+    parent.getModuleInfo().setServerActionsFolder(new File("other"));
+    resolveService(child, parent);
+    assertEquals(serverActions.getPath(), child.getModuleInfo().getServerActionsFolder().getPath());
+  }
+
+  @Test
   public void testResolve_CustomCommands() throws Exception {
     List<CustomCommandDefinition> customCommands = new ArrayList<CustomCommandDefinition>();
     CustomCommandDefinition cmd1 = new CustomCommandDefinition();

http://git-wip-us.apache.org/repos/asf/ambari/blob/eecd8513/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
index 0676568..8165398 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
@@ -110,6 +110,9 @@ public class StackManagerExtensionTest  {
     File checks = oozie.getChecksFolder();
     assertNotNull(checks);
     assertTrue("Checks dir is " + checks.getPath(), checks.getPath().contains("extensions/EXT/0.1/services/OOZIE2/checks"));
+    File serverActions = oozie.getServerActionsFolder();
+    assertNotNull(serverActions);
+    assertTrue("Server actions dir is " + serverActions.getPath(), serverActions.getPath().contains("extensions/EXT/0.1/services/OOZIE2/server_actions"));
     List<ThemeInfo> themes = oozie.getThemes();
     assertNotNull(themes);
     assertTrue("Number of themes is " + themes.size(), themes.size() == 1);
@@ -127,6 +130,9 @@ public class StackManagerExtensionTest  {
     checks = oozie.getChecksFolder();
     assertNotNull(checks);
     assertTrue("Checks dir is " + checks.getPath(), checks.getPath().contains("extensions/EXT/0.1/services/OOZIE2/checks"));
+    serverActions = oozie.getServerActionsFolder();
+    assertNotNull(serverActions);
+    assertTrue("Server actions dir is " + serverActions.getPath(), serverActions.getPath().contains("extensions/EXT/0.1/services/OOZIE2/server_actions"));
     themes = oozie.getThemes();
     assertNotNull(themes);
     assertTrue("Number of themes is " + themes.size(), themes.size() == 0);


[3/7] ambari git commit: AMBARI-22471 : 'yum remove snappy' deletes ambari-metrics-collector. (avijayan)

Posted by ao...@apache.org.
AMBARI-22471 : 'yum remove snappy' deletes ambari-metrics-collector. (avijayan)


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

Branch: refs/heads/branch-feature-AMBARI-22457
Commit: 17f89c01f2153498e09997d00b528cb83ceec4f5
Parents: fb65aab
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Mon Nov 20 10:43:27 2017 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Mon Nov 20 10:43:27 2017 -0800

----------------------------------------------------------------------
 ambari-metrics/ambari-metrics-assembly/pom.xml | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/17f89c01/ambari-metrics/ambari-metrics-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/pom.xml b/ambari-metrics/ambari-metrics-assembly/pom.xml
index 74d4ae3..f8f27e9 100644
--- a/ambari-metrics/ambari-metrics-assembly/pom.xml
+++ b/ambari-metrics/ambari-metrics-assembly/pom.xml
@@ -225,7 +225,6 @@
                   <description>Maven Recipe: RPM Package.</description>
                   <autoRequires>false</autoRequires>
                   <requires>
-                    <require>snappy</require>
                     <require>${python.ver}</require>
                   </requires>
 


[2/7] ambari git commit: AMBARI-22136 Enable server_action tasks defined in EU/RU upgrade pack xml files to take parameters (push to branch-2.6) (dili)

Posted by ao...@apache.org.
AMBARI-22136 Enable server_action tasks defined in EU/RU upgrade pack xml files to take parameters (push to branch-2.6) (dili)


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

Branch: refs/heads/branch-feature-AMBARI-22457
Commit: fb65aab92ea3024728b2e100b0a90a8f6bbf13d9
Parents: a1d59b7
Author: Di Li <di...@apache.org>
Authored: Fri Nov 17 15:43:02 2017 -0500
Committer: Di Li <di...@apache.org>
Committed: Fri Nov 17 15:43:02 2017 -0500

----------------------------------------------------------------------
 .../ambari/server/actionmanager/Stage.java      |  3 +-
 .../internal/UpgradeResourceProvider.java       |  2 +
 .../stack/upgrade/ServerSideActionTask.java     | 15 +++++++
 .../state/stack/upgrade/TaskParameter.java      | 41 ++++++++++++++++++++
 .../src/main/resources/upgrade-pack.xsd         |  9 +++++
 5 files changed, 69 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fb65aab9/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
index 1d6ceaf..0563bfd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
@@ -443,7 +443,8 @@ public class Stage {
    * @param retryAllowed
    *          indicates whether retry after failure is allowed
    */
-  public synchronized void addServerActionCommand(String actionName, @Nullable String userName,
+  public synchronized void addServerActionCommand(String actionName,
+      @Nullable String userName,
       Role role, RoleCommand command, String clusterName,
       ServiceComponentHostServerActionEvent event, @Nullable Map<String, String> commandParams,
       @Nullable String commandDetail, @Nullable Map<String, Map<String, String>> configTags,

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb65aab9/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index b6846f7..ff326aa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -1409,6 +1409,8 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     stage.setStageId(stageId);
     entity.setStageId(Long.valueOf(stageId));
 
+    Map<String, String> taskParameters = task.getParameters();
+    commandParams.putAll(taskParameters);
     stage.addServerActionCommand(task.getImplementationClass(),
         getManagementController().getAuthName(), Role.AMBARI_SERVER_ACTION, RoleCommand.EXECUTE,
         cluster.getClusterName(),

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb65aab9/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServerSideActionTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServerSideActionTask.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServerSideActionTask.java
index 045c9ac..ee16bf7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServerSideActionTask.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServerSideActionTask.java
@@ -18,7 +18,9 @@
 package org.apache.ambari.server.state.stack.upgrade;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
@@ -31,6 +33,19 @@ public abstract class ServerSideActionTask extends Task {
   @XmlAttribute(name="class")
   protected String implClass;
 
+  @XmlElement(name = "parameter")
+  public List<TaskParameter> parameters;
+
+  public Map<String, String> getParameters(){
+    Map<String, String> result = new HashMap<String, String>();
+    if (parameters != null) {
+      for (TaskParameter parameter : parameters) {
+        result.put(parameter.name, parameter.value);
+      }
+    }
+    return result;
+  }
+
   public static final String actionVerb = "Executing";
 
   public String getImplementationClass() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb65aab9/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskParameter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskParameter.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskParameter.java
new file mode 100644
index 0000000..7773a67
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskParameter.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.state.stack.upgrade;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * Optional parameter defined in upgrade packs to be used by server actions.
+ * These parameters are passed to corresponding server action as part of the command parameters.
+ * */
+public class TaskParameter {
+
+  /**
+   * Name of the parameter
+   * */
+  @XmlAttribute (name = "name")
+  public String name;
+
+  /**
+   * Parameter value
+   * */
+  @XmlValue
+  public String value;
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb65aab9/ambari-server/src/main/resources/upgrade-pack.xsd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade-pack.xsd b/ambari-server/src/main/resources/upgrade-pack.xsd
index 249725e..9e50a08 100644
--- a/ambari-server/src/main/resources/upgrade-pack.xsd
+++ b/ambari-server/src/main/resources/upgrade-pack.xsd
@@ -292,6 +292,15 @@
       <xs:extension base="abstract-task-type">
         <xs:sequence>
           <xs:element name="message" minOccurs="0" maxOccurs="unbounded" />
+          <xs:element name="parameter" minOccurs="0" maxOccurs="unbounded">
+            <xs:complexType>
+              <xs:simpleContent>
+                <xs:extension base="xs:string">
+                  <xs:attribute name="name" />
+                </xs:extension>
+              </xs:simpleContent>
+            </xs:complexType>
+          </xs:element>
         </xs:sequence>
       </xs:extension>
     </xs:complexContent>


[7/7] ambari git commit: Merge branch 'branch-2.6' into branch-feature-AMBARI-22457

Posted by ao...@apache.org.
Merge branch 'branch-2.6' into branch-feature-AMBARI-22457


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

Branch: refs/heads/branch-feature-AMBARI-22457
Commit: c7457a820046392dfaf5ca06202143d06c4f143b
Parents: 58c7f78 0615fa0
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Nov 22 10:44:42 2017 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Nov 22 10:44:42 2017 +0200

----------------------------------------------------------------------
 .../libraries/functions/copy_tarball.py         |  60 ++++----
 ambari-metrics/ambari-metrics-assembly/pom.xml  |   1 -
 ambari-server/pom.xml                           |  12 ++
 .../ambari/server/actionmanager/Stage.java      |   3 +-
 .../internal/UpgradeResourceProvider.java       |   2 +
 .../serveraction/ServerActionExecutor.java      | 147 +++++++++++++++++--
 .../ambari/server/stack/ServiceDirectory.java   |  29 ++++
 .../ambari/server/stack/ServiceModule.java      |   8 +
 .../apache/ambari/server/state/ServiceInfo.java |  14 ++
 .../stack/upgrade/ServerSideActionTask.java     |  15 ++
 .../state/stack/upgrade/TaskParameter.java      |  41 ++++++
 .../stacks/HDP/2.6/services/stack_advisor.py    |  11 +-
 .../src/main/resources/upgrade-pack.xsd         |   9 ++
 .../ambari/server/stack/ServiceModuleTest.java  |  30 ++++
 .../server/stack/StackManagerExtensionTest.java |   6 +
 .../main/service/reassign/step3_controller.js   |   3 +
 .../main/service/reassign/step4_controller.js   |  12 +-
 .../service/reassign/step4_controller_test.js   |   9 +-
 18 files changed, 355 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c7457a82/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
----------------------------------------------------------------------


[5/7] ambari git commit: AMBARI-22488 RU: Restarting HiveServer2 on RU failed (dgrinenko)

Posted by ao...@apache.org.
AMBARI-22488 RU: Restarting HiveServer2 on RU failed (dgrinenko)


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

Branch: refs/heads/branch-feature-AMBARI-22457
Commit: a49be4af86484a55816cf8bf3aba06d24e176335
Parents: eecd851
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Tue Nov 21 16:59:17 2017 +0200
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Tue Nov 21 16:59:17 2017 +0200

----------------------------------------------------------------------
 .../libraries/functions/copy_tarball.py         | 60 ++++++++++----------
 1 file changed, 29 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a49be4af/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
index b05c97c..d1c295d 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
@@ -190,6 +190,7 @@ def get_sysprep_skip_copy_tarballs_hdfs():
     sysprep_skip_copy_tarballs_hdfs = default("/configurations/cluster-env/sysprep_skip_copy_tarballs_hdfs", False)
   return sysprep_skip_copy_tarballs_hdfs
 
+
 def get_tarball_paths(name, use_upgrading_version_during_upgrade=True, custom_source_file=None, custom_dest_file=None):
   """
   For a given tarball name, get the source and destination paths to use.
@@ -197,50 +198,47 @@ def get_tarball_paths(name, use_upgrading_version_during_upgrade=True, custom_so
   :param use_upgrading_version_during_upgrade:
   :param custom_source_file: If specified, use this source path instead of the default one from the map.
   :param custom_dest_file: If specified, use this destination path instead of the default one from the map.
-  :return: A tuple of (success status, source path, destination path, optional preparation function which is invoked to setup the tarball)
+  :return: A tuple of success status, source path, destination path, optional preparation function which is invoked to setup the tarball
   """
   stack_name = Script.get_stack_name()
 
-  if not stack_name:
-    Logger.error("Cannot copy {0} tarball to HDFS because stack name could not be determined.".format(str(name)))
-    return False, None, None
+  try:
+    if not stack_name:
+      raise ValueError("Cannot copy {0} tarball to HDFS because stack name could not be determined.".format(str(name)))
 
-  if name is None or name.lower() not in TARBALL_MAP:
-    Logger.error("Cannot copy tarball to HDFS because {0} is not supported in stack {1} for this operation.".format(str(name), str(stack_name)))
-    return False, None, None
+    if name is None or name.lower() not in TARBALL_MAP:
+      raise ValueError("Cannot copy tarball to HDFS because {0} is not supported in stack {1} for this operation.".format(str(name), str(stack_name)))
 
-  service = TARBALL_MAP[name.lower()]['service']
+    service = TARBALL_MAP[name.lower()]
+    service_name = service['service']
+    stack_version = get_current_version(service=service_name, use_upgrading_version_during_upgrade=use_upgrading_version_during_upgrade)
+    stack_root = Script.get_stack_root()
 
-  stack_version = get_current_version(service=service, use_upgrading_version_during_upgrade=use_upgrading_version_during_upgrade)
-  if not stack_version:
-    Logger.error("Cannot copy {0} tarball to HDFS because stack version could be be determined.".format(str(name)))
-    return False, None, None
+    if not stack_version or not stack_root:
+      raise ValueError("Cannot copy {0} tarball to HDFS because stack version could be be determined.".format(str(name)))
 
-  stack_root = Script.get_stack_root()
-  if not stack_root:
-    Logger.error("Cannot copy {0} tarball to HDFS because stack root could be be determined.".format(str(name)))
-    return False, None, None
+    source_file, dest_file = service['dirs']
 
-  (source_file, dest_file) = TARBALL_MAP[name.lower()]['dirs']
+    if custom_source_file is not None:
+      source_file = custom_source_file
 
-  if custom_source_file is not None:
-    source_file = custom_source_file
+    if custom_dest_file is not None:
+      dest_file = custom_dest_file
 
-  if custom_dest_file is not None:
-    dest_file = custom_dest_file
+    source_file = source_file.replace(STACK_NAME_PATTERN, stack_name.lower())
+    dest_file = dest_file.replace(STACK_NAME_PATTERN, stack_name.lower())
 
-  source_file = source_file.replace(STACK_NAME_PATTERN, stack_name.lower())
-  dest_file = dest_file.replace(STACK_NAME_PATTERN, stack_name.lower())
+    source_file = source_file.replace(STACK_ROOT_PATTERN, stack_root.lower())
+    dest_file = dest_file.replace(STACK_ROOT_PATTERN, stack_root.lower())
 
-  source_file = source_file.replace(STACK_ROOT_PATTERN, stack_root.lower())
-  dest_file = dest_file.replace(STACK_ROOT_PATTERN, stack_root.lower())
+    source_file = source_file.replace(STACK_VERSION_PATTERN, stack_version)
+    dest_file = dest_file.replace(STACK_VERSION_PATTERN, stack_version)
 
-  source_file = source_file.replace(STACK_VERSION_PATTERN, stack_version)
-  dest_file = dest_file.replace(STACK_VERSION_PATTERN, stack_version)
+    prepare_function = service['prepare_function'] if "prepare_function" in service else None
 
-  prepare_function = None
-  if "prepare_function" in TARBALL_MAP[name.lower()]:
-    prepare_function = TARBALL_MAP[name.lower()]['prepare_function']
+  except ValueError as e:
+    Logger.error(str(e))
+    return False, None, None, None
 
   return True, source_file, dest_file, prepare_function
 
@@ -339,7 +337,7 @@ def copy_to_hdfs(name, user_group, owner, file_mode=0444, custom_source_file=Non
   import params
 
   Logger.info("Called copy_to_hdfs tarball: {0}".format(name))
-  (success, source_file, dest_file, prepare_function) = get_tarball_paths(name, use_upgrading_version_during_upgrade,
+  success, source_file, dest_file, prepare_function = get_tarball_paths(name, use_upgrading_version_during_upgrade,
                                                                           custom_source_file, custom_dest_file)
 
   if not success:


[6/7] ambari git commit: BUG-91896. Moving Metrics Collector Forces ZooKeeper Server Install on Target Host (alexantonenko)

Posted by ao...@apache.org.
BUG-91896. Moving Metrics Collector Forces ZooKeeper Server Install on Target Host (alexantonenko)


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

Branch: refs/heads/branch-feature-AMBARI-22457
Commit: 0615fa0f6fa0bd90cd2e9b1001b2406f89be2543
Parents: a49be4a
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Tue Nov 21 20:08:30 2017 +0300
Committer: Alex Antonenko <aa...@hortonworks.com>
Committed: Tue Nov 21 20:08:30 2017 +0300

----------------------------------------------------------------------
 .../main/service/reassign/step3_controller.js           |  3 +++
 .../main/service/reassign/step4_controller.js           | 12 ++++++++++--
 .../main/service/reassign/step4_controller_test.js      |  9 ++++++---
 3 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0615fa0f/ambari-web/app/controllers/main/service/reassign/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step3_controller.js b/ambari-web/app/controllers/main/service/reassign/step3_controller.js
index 4898b75..d994aaf 100644
--- a/ambari-web/app/controllers/main/service/reassign/step3_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step3_controller.js
@@ -286,6 +286,9 @@ App.ReassignMasterWizardStep3Controller = Em.Controller.extend({
         success: 'onLoadConfigsTags'
       });
     }
+    else{
+      this.set('isLoaded', true);
+    }
   },
 
   clearStep: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/0615fa0f/ambari-web/app/controllers/main/service/reassign/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
index c610b13..daa28f8 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
@@ -108,13 +108,21 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
    */
   setDependentHostComponents: function (componentName) {
     var installedServices = App.Service.find().mapProperty('serviceName');
-    var installedComponents = App.Host.find(this.get('content.reassignHosts.target'))
+    var hostInstalledComponents = App.Host.find(this.get('content.reassignHosts.target'))
         .get('hostComponents')
         .mapProperty('componentName');
+    var clusterInstalledComponents = App.MasterComponent.find().toArray()
+        .concat(App.ClientComponent.find().toArray())
+        .concat(App.SlaveComponent.find().toArray())
+        .filter(function(service){
+          return service.get("installedCount") > 0;
+        })
+        .mapProperty('componentName');
+
     var dependenciesToInstall = App.StackServiceComponent.find(componentName)
         .get('dependencies')
         .filter(function (component) {
-          return !installedComponents.contains(component.componentName) && installedServices.contains(component.serviceName);
+          return !(component.scope == 'host' ? hostInstalledComponents : clusterInstalledComponents).contains(component.componentName) && (installedServices.contains(component.serviceName));
         })
         .mapProperty('componentName');
     this.set('dependentHostComponents', dependenciesToInstall);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0615fa0f/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
index 8eb9c9f..42f6f91 100644
--- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
@@ -1104,15 +1104,18 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
         dependencies: [
           Em.Object.create({
             componentName: 'C1',
-            serviceName: 'S1'
+            serviceName: 'S1',
+            scope: 'host'
           }),
           Em.Object.create({
             componentName: 'C2',
-            serviceName: 'S2'
+            serviceName: 'S2',
+            scope: 'host'
           }),
           Em.Object.create({
             componentName: 'C3',
-            serviceName: 'S3'
+            serviceName: 'S3',
+            scope: 'host'
           })
         ]
       }));