ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-9155. Ambari Metrics service to be checked for install by default, warn if unchecked. (akovalenko)
Date Fri, 16 Jan 2015 09:30:15 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 45d785df7 -> 06f4a89fd


AMBARI-9155. Ambari Metrics service to be checked for install by default, warn if unchecked.
(akovalenko)


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

Branch: refs/heads/trunk
Commit: 06f4a89fd52f6f2f15c53d29271b50980a442e2b
Parents: 45d785d
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Thu Jan 15 20:11:45 2015 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Fri Jan 16 11:27:33 2015 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step4_controller.js  |  40 ++++-
 ambari-web/app/messages.js                      |   4 +-
 ambari-web/app/routes/add_service_routes.js     |   2 +
 ambari-web/app/routes/installer.js              |   2 +
 .../test/controllers/wizard/step4_test.js       | 177 ++++++++++++++-----
 5 files changed, 178 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/06f4a89f/ambari-web/app/controllers/wizard/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step4_controller.js b/ambari-web/app/controllers/wizard/step4_controller.js
index 2620fae..ad1d210 100644
--- a/ambari-web/app/controllers/wizard/step4_controller.js
+++ b/ambari-web/app/controllers/wizard/step4_controller.js
@@ -78,6 +78,24 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   },
 
   /**
+   * Check whether user selected Ambari Metrics service to install and go to next step
+   * @method ambariMetricsValidation
+   */
+  ambariMetricsValidation: function () {
+    //TODO Change 'AMS' to the actual serviceName after it's changed
+    var ambariMetricsService = this.findProperty('serviceName', 'AMS');
+    if (ambariMetricsService) {
+      if (!ambariMetricsService.get('isSelected')) {
+        this.addValidationError({
+          id: 'ambariMetricsCheck',
+          type: 'WARNING',
+          callback: this.ambariMetricsCheckPopup
+        });
+      }
+    }
+  },
+
+  /**
    * Onclick handler for <code>Next</code> button.
    * @method submit
    */
@@ -111,6 +129,9 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   validate: function() {
     this.serviceDependencyValidation();
     this.fileSystemServiceValidation();
+    if (this.get('wizardController.name') == 'installerController') {
+      this.ambariMetricsValidation();
+    }
     if (!!this.get('errorStack').filterProperty('isShown', false).length) {
       this.showError(this.get('errorStack').findProperty('isShown', false));
       return false;
@@ -322,6 +343,23 @@ App.WizardStep4Controller = Em.ArrayController.extend({
         this.hide();
       }
     });
-  }
+  },
 
+  /**
+   * Show popup with info about not selected Ambari Metrics service
+   * @return {App.ModalPopup}
+   * @method ambariMetricsCheckPopup
+   */
+  ambariMetricsCheckPopup: function () {
+    var self = this;
+    return App.ModalPopup.show({
+      header: Em.I18n.t('installer.step4.ambariMetricsCheck.popup.header'),
+      body: Em.I18n.t('installer.step4.ambariMetricsCheck.popup.body'),
+      primary: Em.I18n.t('common.proceedAnyway'),
+      onPrimary: function () {
+        self.onPrimaryPopupCallback();
+        this.hide();
+      }
+    });
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/06f4a89f/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index a9ea7e3..8a8c7ea 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -651,8 +651,8 @@ Em.I18n.translations = {
   'installer.step4.multipleDFS.popup.body':'You selected more than one file system. We will
automatically select only {0}. Is this OK?',
   'installer.step4.serviceCheck.popup.header':'{0} Needed',
   'installer.step4.serviceCheck.popup.body':'You did not select {0}, but it is needed by
other services you selected. We will automatically add {0}. Is this OK?',
-  'installer.step4.monitoringCheck.popup.header':'Limited Functionality Warning',
-  'installer.step4.monitoringCheck.popup.body':'You did not select {0}. If {1} is not selected,
monitoring and alerts will not function properly. Is this OK?',
+  'installer.step4.ambariMetricsCheck.popup.header':'Limited Functionality Warning',
+  'installer.step4.ambariMetricsCheck.popup.body':'Ambari Metrics collects metrics from the
cluster and makes them available to Ambari.  If you do not install Ambari Metrics service,
metrics will not be accessible from Ambari.  Are you sure you want to proceed without Ambari
Metrics?',
 
   'installer.step5.header':'Assign Masters',
   'installer.step5.reassign.header':'Select Target Host',

http://git-wip-us.apache.org/repos/asf/ambari/blob/06f4a89f/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 71d5e3e..02723f9 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -104,6 +104,8 @@ module.exports = App.WizardRoute.extend({
       controller.set('hideBackButton', true);
       controller.dataLoading().done(function () {
         controller.loadAllPriorSteps();
+        var wizardStep4Controller = router.get('wizardStep4Controller');
+        wizardStep4Controller.set('wizardController', controller);
         controller.connectOutlet('wizardStep4', controller.get('content.services').filterProperty('isInstallable',
true));
       });
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/06f4a89f/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index f403ed5..fef2e4a 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -237,6 +237,8 @@ module.exports = Em.Route.extend({
       var controller = router.get('installerController');
       controller.setCurrentStep('4');
       controller.loadAllPriorSteps().done(function () {
+        var wizardStep4Controller = router.get('wizardStep4Controller');
+        wizardStep4Controller.set('wizardController', controller);
         controller.connectOutlet('wizardStep4', App.StackService.find().filterProperty('isInstallable',
true));
       });
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/06f4a89f/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index bb4e15d..1411edb 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -25,7 +25,7 @@ describe('App.WizardStep4Controller', function () {
 
   var services = [
     'HDFS', 'NAGIOS', 'GANGLIA', 'OOZIE', 'HIVE', 'HBASE', 'PIG', 'SCOOP', 'ZOOKEEPER',
-    'YARN', 'MAPREDUCE2', 'FALCON', 'TEZ', 'STORM'
+    'YARN', 'MAPREDUCE2', 'FALCON', 'TEZ', 'STORM', 'AMS'
   ];
 
   var controller = App.WizardStep4Controller.create();
@@ -227,50 +227,100 @@ describe('App.WizardStep4Controller', function () {
 
   describe('#validate()', function() {
     var tests = [
-      {
-        services: ['HDFS','ZOOKEEPER'],
-        errorsExpected: []
-      },
-      {
-        services: ['ZOOKEEPER'],
-        errorsExpected: []
-      },
-      {
-        services: ['HDFS'],
-        errorsExpected: ['serviceCheck_ZOOKEEPER']
-      },
-      {
-        services: ['HDFS', 'TEZ', 'ZOOKEEPER'],
-        errorsExpected: ['serviceCheck_YARN']
-      },
-      {
-        services: ['HDFS', 'ZOOKEEPER', 'FALCON', 'NAGIOS'],
-        errorsExpected: ['serviceCheck_OOZIE']
-      },
-      {
-        services: ['HDFS', 'ZOOKEEPER', 'GANGLIA', 'NAGIOS', 'HIVE'],
-        errorsExpected: ['serviceCheck_YARN']
-      },
-      {
-        services: ['HDFS', 'GLUSTERFS', 'ZOOKEEPER', 'HIVE'],
-        errorsExpected: ['serviceCheck_YARN', 'multipleDFS']
-      },
-      {
-        services: ['HDFS','ZOOKEEPER', 'NAGIOS', 'GANGLIA'],
-        errorsExpected: []
-      }
-    ];
+        {
+          services: ['HDFS','ZOOKEEPER'],
+          errorsExpected: ['ambariMetricsCheck']
+        },
+        {
+          services: ['ZOOKEEPER'],
+          errorsExpected: ['ambariMetricsCheck']
+        },
+        {
+          services: ['HDFS'],
+          errorsExpected: ['serviceCheck_ZOOKEEPER', 'ambariMetricsCheck']
+        },
+        {
+          services: ['HDFS', 'TEZ', 'ZOOKEEPER'],
+          errorsExpected: ['serviceCheck_YARN', 'ambariMetricsCheck']
+        },
+        {
+          services: ['HDFS', 'ZOOKEEPER', 'FALCON', 'NAGIOS'],
+          errorsExpected: ['serviceCheck_OOZIE', 'ambariMetricsCheck']
+        },
+        {
+          services: ['HDFS', 'ZOOKEEPER', 'GANGLIA', 'NAGIOS', 'HIVE'],
+          errorsExpected: ['serviceCheck_YARN', 'ambariMetricsCheck']
+        },
+        {
+          services: ['HDFS', 'GLUSTERFS', 'ZOOKEEPER', 'HIVE'],
+          errorsExpected: ['serviceCheck_YARN', 'multipleDFS', 'ambariMetricsCheck']
+        },
+        {
+          services: ['HDFS','ZOOKEEPER', 'NAGIOS', 'GANGLIA'],
+          errorsExpected: ['ambariMetricsCheck']
+        },
+        {
+          services: ['HDFS','ZOOKEEPER', 'AMS'],
+          errorsExpected: []
+        },
+        {
+          services: ['ZOOKEEPER', 'AMS'],
+          errorsExpected: []
+        },
+        {
+          services: ['HDFS', 'AMS'],
+          errorsExpected: ['serviceCheck_ZOOKEEPER']
+        },
+        {
+          services: ['HDFS', 'TEZ', 'ZOOKEEPER', 'AMS'],
+          errorsExpected: ['serviceCheck_YARN']
+        },
+        {
+          services: ['HDFS', 'ZOOKEEPER', 'FALCON', 'NAGIOS', 'AMS'],
+          errorsExpected: ['serviceCheck_OOZIE']
+        },
+        {
+          services: ['HDFS', 'ZOOKEEPER', 'GANGLIA', 'NAGIOS', 'HIVE', 'AMS'],
+          errorsExpected: ['serviceCheck_YARN']
+        },
+        {
+          services: ['HDFS', 'GLUSTERFS', 'ZOOKEEPER', 'HIVE', 'AMS'],
+          errorsExpected: ['serviceCheck_YARN', 'multipleDFS']
+        },
+        {
+          services: ['HDFS','ZOOKEEPER', 'NAGIOS', 'GANGLIA', 'AMS'],
+          errorsExpected: []
+        }
+      ],
+      controllerNames = ['installerController', 'addServiceController'],
+      wizardNames = {
+        installerController: 'Install Wizard',
+        addServiceController: 'Add Service Wizard'
+      };
+
+    controllerNames.forEach(function (name) {
+      tests.forEach(function(test) {
+        var errorsExpected = test.errorsExpected;
+        if (name != 'installerController') {
+          errorsExpected = test.errorsExpected.without('ambariMetricsCheck');
+        }
+        var message = '{0}, {1} selected validation should be {2}, errors: {3}'
+          .format(wizardNames[name], test.services.join(','), errorsExpected.length ? 'passed'
: 'failed',
+            errorsExpected.length ? errorsExpected.join(',') : 'absent');
+        it(message, function() {
+          controller.clear();
+          controller.setProperties({
+            content: generateSelectedServicesContent(test.services),
+            wizardController: Em.Object.create({
+              name: name
+            })
+          });
+          controller.validate();
+          expect(controller.get('errorStack').mapProperty('id')).to.eql(errorsExpected.toArray());
+        });
+      })
+    });
 
-    tests.forEach(function(test) {
-      var message = '{0} selected validation should be {1}, errors with ids: {2} present'
-        .format(test.services.join(','), !!test.validationPassed ? 'passed' : 'failed', test.errorsExpected.join(','));
-      it(message, function() {
-        controller.clear();
-        controller.set('content', generateSelectedServicesContent(test.services));
-        controller.validate();
-        expect(controller.get('errorStack').mapProperty('id')).to.be.eql(test.errorsExpected);
-      });
-    })
   });
 
   describe('#onPrimaryPopupCallback()', function() {
@@ -467,4 +517,43 @@ describe('App.WizardStep4Controller', function () {
     })
   });
 
+  describe('#ambariMetricsValidation', function () {
+
+    var cases = [
+      {
+        services: ['HDFS'],
+        isAmbariMetricsWarning: false,
+        title: 'Ambari Metrics not available'
+      },
+      {
+        services: ['AMS'],
+        isAmbariMetricsSelected: false,
+        isAmbariMetricsWarning: true,
+        title: 'Ambari Metrics not selected'
+      },
+      {
+        services: ['AMS'],
+        isAmbariMetricsSelected: true,
+        isAmbariMetricsWarning: false,
+        title: 'Ambari Metrics selected'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        controller.clear();
+        controller.set('content', generateSelectedServicesContent(item.services));
+        var ams = controller.findProperty('serviceName', 'AMS');
+        if (item.services.contains('AMS')) {
+          ams.set('isSelected', item.isAmbariMetricsSelected);
+        } else {
+          controller.removeObject(ams);
+        }
+        controller.ambariMetricsValidation();
+        expect(controller.get('errorStack').mapProperty('id').contains('ambariMetricsCheck')).to.equal(item.isAmbariMetricsWarning);
+      });
+    });
+
+  });
+
 });


Mime
View raw message