You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by is...@apache.org on 2018/02/15 15:46:10 UTC

[ambari] branch trunk updated: [AMBARI-22955] Bulk operation to turn on Maintanance Mode on hosts does not work. (#317)

This is an automated email from the ASF dual-hosted git repository.

ishanbha pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6c3d925  [AMBARI-22955] Bulk operation to turn on Maintanance Mode on hosts does not work. (#317)
6c3d925 is described below

commit 6c3d925abecfdc4e7de6ec25512c2cc765660e4c
Author: Ishan Bhatt <is...@gmail.com>
AuthorDate: Thu Feb 15 07:46:07 2018 -0800

    [AMBARI-22955] Bulk operation to turn on Maintanance Mode on hosts does not work. (#317)
---
 .../controllers/main/host/bulk_operations_controller.js | 17 +++++++++++++----
 ambari-web/app/models/stack_version/version.js          |  4 +++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/ambari-web/app/controllers/main/host/bulk_operations_controller.js b/ambari-web/app/controllers/main/host/bulk_operations_controller.js
index 86c0db4..bb0cffd 100644
--- a/ambari-web/app/controllers/main/host/bulk_operations_controller.js
+++ b/ambari-web/app/controllers/main/host/bulk_operations_controller.js
@@ -1082,6 +1082,7 @@ App.BulkOperationsController = Em.Controller.extend({
     var self = this;
     var operationData = param.operationData;
     var hosts = this._convertHostsObjects(App.hostsMapper.map(json, true));
+    var repoVersion = null;
     // no hosts - no actions
     if (!hosts.length) {
       return;
@@ -1097,7 +1098,15 @@ App.BulkOperationsController = Em.Controller.extend({
        hostNamesSkipped = this._getSkippedForDecommissionHosts(json, hosts, operationData);
      }
      if ('PASSIVE_STATE' === operationData.action) {
-       hostNamesSkipped = this._getSkippedForPassiveStateHosts(hosts);
+       repoVersion = App.StackVersion.find().findProperty('isCurrent');
+       if (!repoVersion && App.StackVersion.find().toArray().length === 1) {
+        repoVersion = App.StackVersion.find().findProperty('isOutOfSync');
+       }
+       if (!repoVersion) {
+        console.error("CLUSTER STACK VERSIONS ERROR: multiple clusters in OUT_OF_SYNC state OR none in CURRENT or OUT_OF_SYNC state");
+        return;
+       }
+       hostNamesSkipped = this._getSkippedForPassiveStateHosts(hosts, repoVersion);
      }
 
     var message = "";
@@ -1139,7 +1148,7 @@ App.BulkOperationsController = Em.Controller.extend({
               return Em.I18n.t('hosts.bulkOperation.warningInfo.body');
             case "PASSIVE_STATE":
               return operationData.state === 'OFF' ? Em.I18n.t('hosts.passiveMode.popup.version.mismatch.multiple')
-                .format(App.StackVersion.find().findProperty('isCurrent').get('repositoryVersion.repositoryVersion')) : "";
+                .format(repoVersion.get('repositoryVersion.repositoryVersion')) : "";
             default:
               return ""
           }
@@ -1206,10 +1215,10 @@ App.BulkOperationsController = Em.Controller.extend({
    * @private
    * @method _getSkippedForPassiveStateHosts
    */
-  _getSkippedForPassiveStateHosts: function (hosts) {
+  _getSkippedForPassiveStateHosts: function (hosts, repoVersion) {
     var hostNames = hosts.mapProperty('hostName');
     var hostNamesSkipped = [];
-    var outOfSyncHosts = App.StackVersion.find().findProperty('isCurrent').get('outOfSyncHosts');
+    var outOfSyncHosts = repoVersion.get('outOfSyncHosts') || [];
     for (var i = 0; i < outOfSyncHosts.length; i++) {
       if (hostNames.contains(outOfSyncHosts[i])) {
         hostNamesSkipped.push(outOfSyncHosts[i]);
diff --git a/ambari-web/app/models/stack_version/version.js b/ambari-web/app/models/stack_version/version.js
index 45e09e6..c000a8e 100644
--- a/ambari-web/app/models/stack_version/version.js
+++ b/ambari-web/app/models/stack_version/version.js
@@ -43,7 +43,9 @@ App.StackVersion = DS.Model.extend({
 
   noInitHosts: Em.computed.empty('notInstalledHosts'),
 
-  isCurrent: Em.computed.equal('state', 'CURRENT')
+  isCurrent: Em.computed.equal('state', 'CURRENT'),
+
+  isOutOfSync: Em.computed.equal('state', 'OUT_OF_SYNC')
 });
 
 App.StackVersion.FIXTURES = [];

-- 
To stop receiving notification emails like this one, please contact
ishanbha@apache.org.