AMBARI-7182. HDFS should be successfully added on storm+zk cluster. (jaimin)


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

Branch: refs/heads/branch-alerts-dev
Commit: 5986ad5fc5c282313905c7066364f0486de3ea36
Parents: badfbce
Author: Jaimin Jetly <jai...@hortonworks.com>
Authored: Fri Sep 5 17:05:05 2014 -0700
Committer: Jaimin Jetly <jai...@hortonworks.com>
Committed: Fri Sep 5 17:05:13 2014 -0700

----------------------------------------------------------------------
 .../controllers/main/service/add_controller.js  | 23 +++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5986ad5f/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js 
b/ambari-web/app/controllers/main/service/add_controller.js
index cce1f5f..7c7ac46 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -241,6 +241,8 @@ App.AddServiceController = App.WizardController.extend({
     var installedComponentsMap = {};
     var uninstalledComponents = [];
     var hosts = this.get('content.hosts');
+    var masterComponents = App.get('components.masters');
+    var nonMasterComponentHosts = [];
 
     components.forEach(function (component) {
       if (installedServices.contains(component.get('serviceName'))) {
@@ -252,11 +254,18 @@ App.AddServiceController = App.WizardController.extend({
 
     for (var hostName in hosts) {
       if (hosts[hostName].isInstalled) {
+        var isMasterComponentHosted = false;
         hosts[hostName].hostComponents.forEach(function (component) {
           if (installedComponentsMap[component.HostRoles.component_name]) {
             
installedComponentsMap[component.HostRoles.component_name].push(hostName);
           }
+          if (masterComponents.contains(component.HostRoles.component_name)) {
+            isMasterComponentHosted = true;
+          }
         }, this);
+        if (!isMasterComponentHosted) {
+          nonMasterComponentHosts.push(hostName);
+        }
       }
     }
 
@@ -277,13 +286,21 @@ App.AddServiceController = App.WizardController.extend({
       result.push(component);
     }
 
+    if (!nonMasterComponentHosts.length) {
+      nonMasterComponentHosts.push(Object.keys(this.get('content.hosts'))[0]);
+    }
+    var uninstalledComponentHosts =  
nonMasterComponentHosts.map(function(_hostName){
+      return {
+        group: "Default",
+        hostName: _hostName,
+        isInstalled: false
+      }
+    });
     uninstalledComponents.forEach(function (component) {
-      var hosts = jQuery.extend(true, [], result.findProperty('componentName', 
'DATANODE').hosts);
-      hosts.setEach('isInstalled', false);
       result.push({
         componentName: component.get('componentName'),
         displayName: App.format.role(component.get('componentName')),
-        hosts: hosts,
+        hosts: uninstalledComponentHosts,
         isInstalled: false
       })
     });

Reply via email to