Browse Source

AMBARI-6267 Add Services fails with a server error under some conditions.(atkach)

atkach 11 years ago
parent
commit
b41ba67e60

+ 13 - 5
ambari-web/app/controllers/wizard/step8_controller.js

@@ -1221,11 +1221,19 @@ App.WizardStep8Controller = Em.Controller.extend({
             /**
              * check whether clients are already installed on selected master hosts!!!
              */
-            var clientHosts = App.HostComponent.find().filterProperty("componentName",_client.component_name).filterProperty("workStatus", "INSTALLED");
-            if (clientHosts.length>0) {
-              clientHosts.mapProperty('hostName').forEach(function (host) {
-                if (hostNames.contains(host)) {
-                  hostNames.splice(hostNames.indexOf(host), 1);
+            var clientHosts = [];
+            var installedHosts = this.get('content.hosts');
+            for (var hostName in installedHosts) {
+              if (installedHosts[hostName].isInstalled &&
+                  installedHosts[hostName].hostComponents.filterProperty('HostRoles.state', 'INSTALLED').mapProperty('HostRoles.component_name').contains(_client.component_name)) {
+                clientHosts.push(hostName);
+              }
+            }
+
+            if (clientHosts.length > 0) {
+              clientHosts.forEach(function (hostName) {
+                if (hostNames.contains(hostName)) {
+                  hostNames.splice(hostNames.indexOf(hostName), 1);
                 }
               }, this);
             }

+ 1 - 1
ambari-web/app/utils/ajax/ajax.js

@@ -2075,7 +2075,7 @@ var urls = {
     'mock': ''
   },
   'hosts.confirmed': {
-    'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,host_components&minimal_response=true',
+    'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,host_components/HostRoles/state&minimal_response=true',
     'mock': ''
   },
   'host_components.all': {