You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/10/03 06:45:03 UTC

svn commit: r1393288 - in /incubator/ambari/branches/AMBARI-666: AMBARI-666-CHANGES.txt ambari-web/app/controllers/installer/step4_controller.js ambari-web/app/messages.js ambari-web/test/installer/step4_test.js

Author: yusaku
Date: Wed Oct  3 04:45:03 2012
New Revision: 1393288

URL: http://svn.apache.org/viewvc?rev=1393288&view=rev
Log:
AMBARI-793. Make MapReduce, Nagios, and Ganglia optional during cluster install. (yusaku)

Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step4_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
    incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step4_test.js

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1393288&r1=1393287&r2=1393288&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Wed Oct  3 04:45:03 2012
@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-793. Make MapReduce, Nagios, and Ganglia optional during cluster
+  install. (yusaku)
+
   AMBARI-794. Add log4j properties for logging at the server. (mahadev)
 
   AMBARI-790. OK in registration response. (jitendra)

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step4_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step4_controller.js?rev=1393288&r1=1393287&r2=1393288&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step4_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step4_controller.js Wed Oct  3 04:45:03 2012
@@ -31,19 +31,19 @@ App.InstallerStep4Controller = Em.ArrayC
     {
       serviceName: 'MAPREDUCE',
       displayName: 'MapReduce',
-      isDisabled: true,
+      isDisabled: false,
       description: Em.I18n.t('services.mapreduce.description')
     },
     {
       serviceName: 'NAGIOS',
       displayName: 'Nagios',
-      isDisabled: true,
+      isDisabled: false,
       description: Em.I18n.t('services.nagios.description')
     },
     {
       serviceName: 'GANGLIA',
       displayName: 'Ganglia',
-      isDisabled: true,
+      isDisabled: false,
       description: Em.I18n.t('services.ganglia.description')
     },
     {
@@ -136,7 +136,61 @@ App.InstallerStep4Controller = Em.ArrayC
     db.setSelectedServiceNames(serviceNames);
   },
 
-  submit: function() {
+  needToAddMapReduce: function () {
+    if (this.findProperty('serviceName', 'MAPREDUCE').get('isSelected') === false) {
+      var mapreduceDependentServices = this.filter(function (item) {
+        return ['PIG', 'OOZIE', 'HIVE'].contains(item.get('serviceName')) && item.get('isSelected', true);
+      });
+      return (mapreduceDependentServices.get('length') > 0);
+    } else {
+      return false;
+    }
+  },
+
+  gangliaOrNagiosNotSelected: function () {
+    return (this.findProperty('serviceName', 'GANGLIA').get('isSelected') === false || this.findProperty('serviceName', 'NAGIOS').get('isSelected') === false);
+  },
+
+  submit: function () {
+    var self = this;
+    if (this.needToAddMapReduce()) {
+      App.ModalPopup.show({
+        header: Em.I18n.t('installer.step4.mapreduceCheck.popup.header'),
+        body: Em.I18n.t('installer.step4.mapreduceCheck.popup.body'),
+        onPrimary: function () {
+          self.findProperty('serviceName', 'MAPREDUCE').set('isSelected', true);
+          this.hide();
+          self.validateMonitoring();
+        },
+        onSecondary: function () {
+          this.hide();
+        }
+      });
+    } else {
+      self.validateMonitoring();
+    }
+  },
+
+  validateMonitoring: function () {
+    var self = this;
+    if (this.gangliaOrNagiosNotSelected()) {
+      App.ModalPopup.show({
+        header: Em.I18n.t('installer.step4.monitoringCheck.popup.header'),
+        body: Em.I18n.t('installer.step4.monitoringCheck.popup.body'),
+        onPrimary: function () {
+          this.hide();
+          self.proceed();
+        },
+        onSecondary: function () {
+          this.hide();
+        }
+      });
+    } else {
+      self.proceed();
+    }
+  },
+
+  proceed: function () {
     this.saveSelectedServiceNamesToDB();
     App.router.send('next');
   }

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js?rev=1393288&r1=1393287&r2=1393288&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js Wed Oct  3 04:45:03 2012
@@ -89,6 +89,10 @@ Em.I18n.translations = {
 
   'installer.step4.header': 'Choose Services',
   'installer.step4.body': 'Choose which services you want to install on your cluster.<br>Note that some services have dependencies (e.g., HBase requires ZooKeeper.)',
+  'installer.step4.mapreduceCheck.popup.header': 'MapReduce Needed',
+  'installer.step4.mapreduceCheck.popup.body': 'You did not select MapReduce, but it is needed by other services you selected.  We will automatically add MapReduce.  Is this OK?',
+  'installer.step4.monitoringCheck.popup.header': 'Limited Functionality Warning',
+  'installer.step4.monitoringCheck.popup.body': 'You did not select Nagios and/or Ganglia.  If both are not selected, monitoring and alerts will not function properly.  Is this OK?',
 
   'installer.step5.header': 'Assign Masters',
   'installer.step5.attention': 'more hosts without master service',

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step4_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step4_test.js?rev=1393288&r1=1393287&r2=1393288&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step4_test.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step4_test.js Wed Oct  3 04:45:03 2012
@@ -21,8 +21,8 @@ require('controllers/installer/step4_con
 
 describe('App.InstallerStep4Controller', function () {
 
-  var DEFAULT_SERVICES = ['HDFS', 'MAPREDUCE', 'NAGIOS', 'GANGLIA'];
-  var OPTIONAL_SERVICES = ['OOZIE', 'HIVE', 'HBASE', 'PIG', 'SQOOP', 'ZOOKEEPER', 'HCATALOG'];
+  var DEFAULT_SERVICES = ['HDFS'];
+  var OPTIONAL_SERVICES = ['MAPREDUCE', 'NAGIOS', 'GANGLIA', 'OOZIE', 'HIVE', 'HBASE', 'PIG', 'SQOOP', 'ZOOKEEPER', 'HCATALOG'];
 
   var controller = App.InstallerStep4Controller.create();
 
@@ -93,6 +93,48 @@ describe('App.InstallerStep4Controller',
 
   })
 
+  describe('#needToAddMapReduce', function() {
+
+    describe('mapreduce not selected', function() {
+      beforeEach(function() {
+        controller.findProperty('serviceName', 'MAPREDUCE').set('isSelected', false);
+      })
+
+      it('should return true if Hive is selected and MapReduce is not selected', function() {
+        controller.findProperty('serviceName', 'HIVE').set('isSelected', true);
+        expect(controller.needToAddMapReduce()).to.equal(true);
+      })
+      it('should return true if Pig is selected and MapReduce is not selected', function() {
+        controller.findProperty('serviceName', 'PIG').set('isSelected', true);
+        expect(controller.needToAddMapReduce()).to.equal(true);
+      })
+      it('should return true if Oozie is selected and MapReduce is not selected', function() {
+        controller.findProperty('serviceName', 'OOZIE').set('isSelected', true);
+        expect(controller.needToAddMapReduce()).to.equal(true);
+      })
+    })
+
+    describe('mapreduce not selected', function() {
+      beforeEach(function() {
+        controller.findProperty('serviceName', 'MAPREDUCE').set('isSelected', true);
+      })
+
+      it('should return false if Hive is selected and MapReduce is selected', function() {
+        controller.findProperty('serviceName', 'HIVE').set('isSelected', true);
+        expect(controller.needToAddMapReduce()).to.equal(false);
+      })
+      it('should return false if Pig is selected and MapReduce is not selected', function() {
+        controller.findProperty('serviceName', 'PIG').set('isSelected', true);
+        expect(controller.needToAddMapReduce()).to.equal(false);
+      })
+      it('should return false if Oozie is selected and MapReduce is not selected', function() {
+        controller.findProperty('serviceName', 'OOZIE').set('isSelected', true);
+        expect(controller.needToAddMapReduce()).to.equal(false);
+      })
+    })
+
+  })
+
   describe('#saveSelectedServiceNamesToDB', function() {
 
     beforeEach(function() {
@@ -108,9 +150,9 @@ describe('App.InstallerStep4Controller',
       App.db.setLoginName('tester');
       App.db.setClusterName('test');
       controller.saveSelectedServiceNamesToDB();
-      console.log('controller length=' + controller.get('length'));
+      // console.log('controller length=' + controller.get('length'));
       var selectedServiceNames = App.db.getSelectedServiceNames();
-      console.log('service length=' + selectedServiceNames.get('length'));
+      // console.log('service length=' + selectedServiceNames.get('length'));
       expect(selectedServiceNames.length === DEFAULT_SERVICES.length + OPTIONAL_SERVICES.length).to.equal(true);
     })