ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject ambari git commit: AMBARI-9810 Install wizard: request to start host check failed. (ababiichuk)
Date Thu, 26 Feb 2015 14:35:59 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 19ec2611b -> c58bf8a55


AMBARI-9810 Install wizard: request to start host check failed. (ababiichuk)


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

Branch: refs/heads/branch-2.0.0
Commit: c58bf8a5566c8c5d1d61bb52c9112040c63a3183
Parents: 19ec261
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Thu Feb 26 15:02:10 2015 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Thu Feb 26 16:35:35 2015 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  | 20 ++++--
 .../test/controllers/wizard/step3_test.js       | 73 ++++++++++++++++++++
 2 files changed, 88 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c58bf8a5/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 0fc0b32..2c545c1 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -855,7 +855,7 @@ App.WizardStep3Controller = Em.Controller.extend({
       this.getHostCheckSuccess();
     } else {
       var data = this.getDataForCheckRequest("host_resolution_check", true);
-      this.requestToPerformHostCheck(data);
+      data ? this.requestToPerformHostCheck(data) : this.stopHostCheck();
     }
   },
 
@@ -864,10 +864,20 @@ App.WizardStep3Controller = Em.Controller.extend({
       this.getHostInfo();
     } else {
       var data = this.getDataForCheckRequest("last_agent_env_check", false);
-      this.requestToPerformHostCheck(data);
+      data ? this.requestToPerformHostCheck(data) : this.stopHostCheck();
     }
   },
 
+  /**
+   * set all fields from which depends runnig host check to true value
+   * which force finish checking;
+   */
+  stopHostCheck: function() {
+    this.set('stopChecking', true);
+    this.set('isJDKWarningsLoaded', true);
+    this.set('isHostsWarningsLoaded', true);
+  },
+
   getHostCheckSuccess: function(response) {
     if (!App.get('testMode')) {
       this.set("requestId", response.Requests.id);
@@ -881,12 +891,12 @@ App.WizardStep3Controller = Em.Controller.extend({
    *  <code>"last_agent_env_check"<code>
    *  <code>"host_resolution_check"<code>
    * @param {boolean} addHosts - true
+   * @return {object|null}
    * @method getDataForCheckRequest
    */
   getDataForCheckRequest: function (checkExecuteList, addHosts) {
-    var hosts = (!this.get('content.installOptions.manualInstall'))
-      ? this.get('bootHosts').filterProperty('bootStatus', 'REGISTERED').getEach('name').join(",")
-      : this.get('bootHosts').getEach('name').join(",");
+    var hosts = this.get('bootHosts').filterProperty('bootStatus', 'REGISTERED').getEach('name').join(",");
+    if (hosts.length == 0) return null;
     var jdk_location = App.router.get('clusterController.ambariProperties.jdk_location');
     var RequestInfo = {
       "action": "check_host",

http://git-wip-us.apache.org/repos/asf/ambari/blob/c58bf8a5/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 38494ba..9846b69 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -2532,4 +2532,77 @@ describe('App.WizardStep3Controller', function () {
     });
 
   });
+
+  describe('#getDataForCheckRequest', function() {
+    var tests = [
+      {
+        bootHosts: [
+          Em.Object.create({'bootStatus': 'REGISTERED', 'name': 'h1'}),
+          Em.Object.create({'bootStatus': 'FAILED', 'name': 'h2'})
+        ],
+        addHosts: true,
+        rez: {
+          RequestInfo: {
+            "action": "check_host",
+            "context": "Check host",
+            "parameters": {
+              "check_execute_list": 'checkExecuteList',
+              "jdk_location" : "jdk_location",
+              "threshold": "20",
+              "hosts": "h1"
+            }
+          },
+          resource_filters: {
+              "hosts": "h1"
+          }
+        },
+        m: 'with add host param'
+      },
+      {
+        bootHosts: [
+          Em.Object.create({'bootStatus': 'REGISTERED', 'name': 'h1'}),
+          Em.Object.create({'bootStatus': 'FAILED', 'name': 'h2'})
+        ],
+        addHosts: false,
+        rez: {
+          RequestInfo: {
+            "action": "check_host",
+            "context": "Check host",
+            "parameters": {
+              "check_execute_list": 'checkExecuteList',
+              "jdk_location" : "jdk_location",
+              "threshold": "20"
+            }
+          },
+          resource_filters: {
+            "hosts": "h1"
+          }
+        },
+        m: 'without add host param'
+      },
+      {
+        bootHosts: [
+          Em.Object.create({'bootStatus': 'FAILED', 'name': 'h1'}),
+          Em.Object.create({'bootStatus': 'FAILED', 'name': 'h2'})
+        ],
+        rez: null,
+        m: 'with all hosts failed'
+      }
+    ];
+
+    beforeEach(function() {
+      sinon.stub(App.get('router'), 'get' , function(p) {
+        return p === 'clusterController.ambariProperties.jdk_location' ? 'jdk_location' :
Em.get(App.get('router'), p);
+      })
+    });
+    afterEach(function() {
+      App.get('router').get.restore();
+    });
+    tests.forEach(function(t) {
+      it(t.m, function() {
+        c.set('bootHosts', t.bootHosts);
+        expect(c.getDataForCheckRequest('checkExecuteList', t.addHosts)).to.be.eql(t.rez);
+      });
+    })
+  });
 });


Mime
View raw message