ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [3/3] ambari git commit: AMBARI-9430 Specify install requirements in Ranger Add Service Wizard. (ababiichuk)
Date Mon, 02 Feb 2015 18:11:55 GMT
AMBARI-9430 Specify install requirements in Ranger Add Service Wizard. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 0865f9e2f3fa465027b44bae3da0927ac727babb
Parents: ccdb917
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Mon Feb 2 19:37:41 2015 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Mon Feb 2 20:11:45 2015 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step4_controller.js  | 54 +++++++++++++++++---
 ambari-web/app/messages.js                      |  7 +++
 .../step4/step4_ranger_requirements_popup.hbs   | 20 ++++++++
 .../test/controllers/wizard/step4_test.js       | 45 +++++++++++++++-
 4 files changed, 117 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0865f9e2/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 673545f..da70e63 100644
--- a/ambari-web/app/controllers/wizard/step4_controller.js
+++ b/ambari-web/app/controllers/wizard/step4_controller.js
@@ -84,14 +84,27 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   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
-        });
-      }
+    if (ambariMetricsService && !ambariMetricsService.get('isSelected')) {
+      this.addValidationError({
+        id: 'ambariMetricsCheck',
+        type: 'WARNING',
+        callback: this.ambariMetricsCheckPopup
+      });
+    }
+  },
+
+  /**
+   * Check whether Ranger is selected and show installation requirements if yes
+   * @method rangerValidation
+   */
+  rangerValidation: function () {
+    var rangerService = this.findProperty('serviceName', 'RANGER');
+    if (rangerService && rangerService.get('isSelected')) {
+      this.addValidationError({
+        id: 'rangerRequirements',
+        type: 'WARNING',
+        callback: this.rangerRequirementsPopup
+      });
     }
   },
 
@@ -132,6 +145,7 @@ App.WizardStep4Controller = Em.ArrayController.extend({
     if (this.get('wizardController.name') == 'installerController') {
       this.ambariMetricsValidation();
     }
+    this.rangerValidation();
     if (!!this.get('errorStack').filterProperty('isShown', false).length) {
       this.showError(this.get('errorStack').findProperty('isShown', false));
       return false;
@@ -361,5 +375,29 @@ App.WizardStep4Controller = Em.ArrayController.extend({
         this.hide();
       }
     });
+  },
+
+  /**
+   * Show popup with installation requirements for Ranger service
+   * @return {App.ModalPopup}
+   * @method rangerRequirementsPopup
+   */
+  rangerRequirementsPopup: function () {
+    var self = this;
+    return App.ModalPopup.show({
+      header: Em.I18n.t('installer.step4.rangerRequirements.popup.header'),
+      bodyClass: Em.View.extend({
+        templateName: require('templates/wizard/step4/step4_ranger_requirements_popup')
+      }),
+      primary: Em.I18n.t('common.proceed'),
+      isChecked: false,
+      disablePrimary: function () {
+        return !this.get('isChecked');
+      }.property('isChecked'),
+      onPrimary: function () {
+        self.onPrimaryPopupCallback();
+        this.hide();
+      }
+    });
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/0865f9e2/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6b9c16a..b0e252b 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -657,6 +657,13 @@ Em.I18n.translations = {
   '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.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.step4.rangerRequirements.popup.header': 'Ranger Requirements',
+  'installer.step4.rangerRequirements.popup.body.requirements': '<ol><li>You
must have an <strong>existing MySQL Server or Oracle Server</strong> database
instance running to be used by Ranger.</li>' +
+    '<li>In Assign Masters step of this wizard, you will be prompted to specify which
host for the Ranger Admin. On that host, you <strong>must have MySQL Client or Oracle
Client installed</strong> for Ranger to access to the database.</li>' +
+    '<li>Ensure that the access for the DB Admin user (<strong>root</strong>
in case of MySQL or <strong>SYS</strong> in case of Oracle) is enabled in DB server
from any host.</li>' +
+    '<li>Execute the following command on the Ambari Server host. Replace <code>database-type</code>
with <strong>mysql</strong> or <strong>oracle</strong> and <code>/jdbc/driver/path</code>
based on the location of the MySQL or Oracle JDBC driver:' +
+    '<pre>ambari-server setup --jdbc-db={database-type} --jdbc-driver={/jdbc/driver/path}</pre></li></ol>',
+  'installer.step4.rangerRequirements.popup.body.confirmation': 'I have met all the requirements
above.',
 
   'installer.step5.header':'Assign Masters',
   'installer.step5.reassign.header':'Select Target Host',

http://git-wip-us.apache.org/repos/asf/ambari/blob/0865f9e2/ambari-web/app/templates/wizard/step4/step4_ranger_requirements_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step4/step4_ranger_requirements_popup.hbs b/ambari-web/app/templates/wizard/step4/step4_ranger_requirements_popup.hbs
new file mode 100644
index 0000000..5057462
--- /dev/null
+++ b/ambari-web/app/templates/wizard/step4/step4_ranger_requirements_popup.hbs
@@ -0,0 +1,20 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+{{t installer.step4.rangerRequirements.popup.body.requirements}}
+<label class="checkbox">{{view Em.Checkbox checkedBinding="isChecked"}}{{t installer.step4.rangerRequirements.popup.body.confirmation}}</label>

http://git-wip-us.apache.org/repos/asf/ambari/blob/0865f9e2/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 1411edb..107145c 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', 'AMS'
+    'YARN', 'MAPREDUCE2', 'FALCON', 'TEZ', 'STORM', 'AMS', 'RANGER'
   ];
 
   var controller = App.WizardStep4Controller.create();
@@ -290,6 +290,10 @@ describe('App.WizardStep4Controller', function () {
         {
           services: ['HDFS','ZOOKEEPER', 'NAGIOS', 'GANGLIA', 'AMS'],
           errorsExpected: []
+        },
+        {
+          services: ['RANGER'],
+          errorsExpected: ['ambariMetricsCheck', 'rangerRequirements']
         }
       ],
       controllerNames = ['installerController', 'addServiceController'],
@@ -556,4 +560,43 @@ describe('App.WizardStep4Controller', function () {
 
   });
 
+  describe('#rangerValidation', function () {
+
+    var cases = [
+      {
+        services: ['HDFS'],
+        isRangerWarning: false,
+        title: 'Ranger not available'
+      },
+      {
+        services: ['RANGER'],
+        isRangerSelected: false,
+        isRangerWarning: false,
+        title: 'Ranger not selected'
+      },
+      {
+        services: ['RANGER'],
+        isRangerSelected: true,
+        isRangerWarning: true,
+        title: 'Ranger selected'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        controller.clear();
+        controller.set('content', generateSelectedServicesContent(item.services));
+        var ranger = controller.findProperty('serviceName', 'RANGER');
+        if (item.services.contains('RANGER')) {
+          ranger.set('isSelected', item.isRangerSelected);
+        } else {
+          controller.removeObject(ranger);
+        }
+        controller.rangerValidation();
+        expect(controller.get('errorStack').mapProperty('id').contains('rangerRequirements')).to.equal(item.isRangerWarning);
+      });
+    });
+
+  });
+
 });


Mime
View raw message