ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [39/50] [abbrv] ambari git commit: AMBARI-14576: Add Service wizard should show security related parameters for HAWQ, if Kerberos is enabled (mithmatt via jaoki)
Date Fri, 08 Jan 2016 18:15:56 GMT
AMBARI-14576: Add Service wizard should show security related parameters for HAWQ, if Kerberos
is enabled (mithmatt via jaoki)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: b8d4a898d694492bbffd645063ae1d026c7f9e61
Parents: 14fd73e
Author: Jun Aoki <jaoki@apache.org>
Authored: Thu Jan 7 15:57:46 2016 -0800
Committer: Jun Aoki <jaoki@apache.org>
Committed: Thu Jan 7 15:57:46 2016 -0800

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 54 ++++++++++++++++++--
 .../test/controllers/wizard/step7_test.js       | 54 ++++++++++++++++++++
 2 files changed, 103 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d4a898/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 5da2d73..42b5b87 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -694,14 +694,17 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     if (this.get('allSelectedServiceNames').contains('YARN')) {
       configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []);
     }
-    // If Hawq service is being added, add NN/RM HA related parameter to hdfs-client/yarn-client
respectively if applicable
-    if (this.get('wizardController.name') == 'addServiceController' && this.get('allSelectedServiceNames').contains('HAWQ'))
{
+    // If HAWQ service is being added, add NN-HA/RM-HA/Kerberos related parameters to hdfs-client/yarn-client
if applicable
+    if (this.get('wizardController.name') == 'addServiceController' && !this.get('installedServiceNames').contains('HAWQ')
&& this.get('allSelectedServiceNames').contains('HAWQ')) {
       if (App.get('isHaEnabled')) {
         this.addHawqConfigsOnNnHa(configs);
       }
       if (App.get('isRMHaEnabled')) {
         this.addHawqConfigsOnRMHa(configs);
       }
+      if (App.get('isKerberosEnabled')) {
+        this.addHawqConfigsOnKerberizedCluster(configs);
+      }
     }
     if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController')
{
       this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs')
|| []);
@@ -814,7 +817,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
    * This method ensures that these additional parameters are added to hdfs-client.xml
    * @param configs existing configs on cluster
    * @returns {Object[]} existing configs + additional config parameters in hdfs-client.xml
-   * @private
    */
   addHawqConfigsOnNnHa: function(configs) {
     var nameService = configs.findProperty('id', 'dfs.nameservices__hdfs-site').value;
@@ -852,7 +854,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
    * This method ensures that these additional parameters are added to yarn-client.xml
    * @param configs existing configs on cluster
    * @returns {Object[]} existing configs + additional config parameters in yarn-client.xml
-   * @private
    */
   addHawqConfigsOnRMHa: function(configs) {
     rmHost1 = configs.findProperty('id', 'yarn.resourcemanager.hostname.rm1__yarn-site').value
;
@@ -870,7 +871,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
         description: 'Comma separated yarn resourcemanager scheduler addresses with port',
         port: '8030'
       }
-    ]
+    ];
 
     yarnConfigToBeAdded.forEach(function(propertyDetails) {
       var newProperty = App.config.createDefaultConfig(propertyDetails.name, 'HAWQ', 'yarn-client.xml',
true);
@@ -891,6 +892,49 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
   },
 
   /**
+   * For Kerberos Enabled cluster, HAWQ service requires additional config parameters in
hdfs-client.xml and hawq-site.xml
+   * This method ensures that these additional parameters are added to hdfs-client.xml and
hawq-site.xml
+   * @param configs existing configs on cluster
+   * @returns {Object[]} existing configs + additional config parameters in hdfs-client.xml
and hawq-site.xml
+   */
+  addHawqConfigsOnKerberizedCluster: function(configs) {
+    Em.A([
+      {
+        name: 'hadoop.security.authentication',
+        value: 'kerberos',
+        filename: 'hdfs-client.xml',
+        isOverridable: false,
+        isReconfigurable: false
+      }, {
+        name: 'enable_secure_filesystem',
+        value: 'ON',
+        filename: 'hawq-site.xml',
+        isOverridable: false,
+        isReconfigurable: false
+      }, {
+        name: 'krb_server_keyfile',
+        value: '/etc/security/keytabs/hawq.service.keytab',
+        filename: 'hawq-site.xml',
+        isOverridable: true,
+        isReconfigurable: true
+      }
+    ]).forEach(function (property) {
+      var newProperty = App.config.createDefaultConfig(property.name, 'HAWQ', property.filename,
true);
+      Em.setProperties(newProperty, {
+        displayName: property.name,
+        displayType: 'string',
+        name: property.name,
+        value: property.value,
+        recommendedValue: property.value,
+        isOverridable: property.isOverridable,
+        isReconfigurable: property.isReconfigurable,
+        isSecureConfig: true
+      });
+      configs.push(App.ServiceConfigProperty.create(newProperty));
+    });
+  },
+
+  /**
    * render configs, distribute them by service
    * and wrap each in ServiceConfigProperty object
    * @param stepConfigs

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d4a898/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index f0da07a..a6a5fab 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1691,6 +1691,8 @@ describe('App.InstallerStep7Controller', function () {
     it('should copy properties from hdfs-site to hdfs-client for HAWQ', function() {
       var oldConfigs = configs.slice();
       installerStep7Controller.addHawqConfigsOnNnHa(configs);
+      // ensure 6 new configs were added
+      expect(configs.length - oldConfigs.length).to.be.eql(6);
       oldConfigs.forEach(function(property){
         // find the same property in hdfs-client for HAWQ and see if attribute value matches
with the corresponding property's attribute value in hdfs-site
         expect(configs.findProperty('id', property.name + '__hdfs-client').description).to.be.eql(property.description);
@@ -1740,6 +1742,58 @@ describe('App.InstallerStep7Controller', function () {
     });
   });
 
+  describe('#addHawqConfigsOnKerberizedCluster', function () {
+    var secureProperties = [
+      {
+        name: 'hadoop.security.authentication',
+        value: 'kerberos',
+        file: 'hdfs-client',
+        isOverridable: false,
+        isReconfigurable: false
+      }, {
+        name: 'enable_secure_filesystem',
+        value: 'ON',
+        file: 'hawq-site',
+        isOverridable: false,
+        isReconfigurable: false
+      }, {
+        name: 'krb_server_keyfile',
+        value: '/etc/security/keytabs/hawq.service.keytab',
+        file: 'hawq-site',
+        isOverridable: true,
+        isReconfigurable: true
+      }
+    ];
+
+    var configs = [
+        {
+          id: 'dummy__dummy-site',
+          description: 'dummy__dummy-site',
+          displayName: 'dummy',
+          displayType: 'string',
+          name: 'dummy',
+          value: 'dummy'
+        }
+      ];
+
+    it('should add three security related configs for HAWQ if Kerberos is enabled', function
() {
+      var originalConfigsLength = configs.length;
+      installerStep7Controller.addHawqConfigsOnKerberizedCluster(configs);
+      // ensure 3 new configs are added
+      expect(configs.length - originalConfigsLength).to.be.eql(3);
+      // check if all three new properties were added
+      secureProperties.forEach(function (newProperty) {
+        var newPropertyAdded = configs.findProperty('id', newProperty.name + '__' + newProperty.file);
+        expect(newPropertyAdded.name).to.be.eql(newProperty.name);
+        expect(newPropertyAdded.displayName).to.be.eql(newProperty.name);
+        expect(newPropertyAdded.value).to.be.eql(newProperty.value);
+        expect(newPropertyAdded.recommendedValue).to.be.eql(newProperty.value);
+        expect(newPropertyAdded.isOverridable).to.be.eql(newProperty.isOverridable);
+        expect(newPropertyAdded.isReconfigurable).to.be.eql(newProperty.isReconfigurable);
+      });
+    });
+  });
+
   describe('#errorsCount', function () {
 
     it('should ignore configs with widgets (enhanced configs)', function () {


Mime
View raw message