ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [1/2] ambari git commit: AMBARI-13199 addHostNamesToConfigs shouldn't be run on Kerberos. (ababiichuk)
Date Wed, 23 Sep 2015 08:45:09 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e24e3c8b7 -> 4f4959d21


AMBARI-13199 addHostNamesToConfigs shouldn't be run on Kerberos. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 4f4959d2113ea9e2f579b4719ef7be39fb2450b8
Parents: f7e29cd
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Wed Sep 23 11:42:58 2015 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Wed Sep 23 11:45:00 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 99 +++++++++++++++++++-
 ambari-web/app/utils/config.js                  | 93 ------------------
 .../test/controllers/wizard/step7_test.js       | 14 +--
 3 files changed, 104 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4f4959d2/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 f6fa238..bedd164 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -17,6 +17,7 @@
  */
 
 var App = require('app');
+var configPropertyHelper = require('utils/configs/config_property_helper');
 /**
  * By Step 7, we have the following information stored in App.db and set on this
  * controller by the router.
@@ -727,7 +728,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
       masterComponentHosts: this.get('wizardController.content.masterComponentHosts'),
       slaveComponentHosts: this.get('wizardController.content.slaveComponentHosts')
     };
-    var serviceConfigs = App.config.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'),
this.get('installedServiceNames'), localDB);
+    var serviceConfigs = this.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'),
this.get('installedServiceNames'), localDB);
     if (this.get('wizardController.name') === 'addServiceController') {
       serviceConfigs.setEach('showConfig', true);
       serviceConfigs.setEach('selected', false);
@@ -767,6 +768,100 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
   },
 
   /**
+   * render configs, distribute them by service
+   * and wrap each in ServiceConfigProperty object
+   * @param configs
+   * @param storedConfigs
+   * @param allSelectedServiceNames
+   * @param installedServiceNames
+   * @param localDB
+   * @return {App.ServiceConfig[]}
+   */
+  renderConfigs: function (configs, storedConfigs, allSelectedServiceNames, installedServiceNames,
localDB) {
+    var renderedServiceConfigs = [];
+    var services = [];
+
+    App.config.get('preDefinedServiceConfigs').forEach(function (serviceConfig) {
+      var serviceName = serviceConfig.get('serviceName');
+      if (allSelectedServiceNames.contains(serviceName) || serviceName === 'MISC') {
+        if (!installedServiceNames.contains(serviceName) || serviceName === 'MISC') {
+          serviceConfig.set('showConfig', true);
+        }
+        services.push(serviceConfig);
+      }
+    });
+    services.forEach(function (service) {
+      var configsByService = [];
+      var serviceConfigs = configs.filterProperty('serviceName', service.get('serviceName'));
+      serviceConfigs.forEach(function (_config) {
+        var serviceConfigProperty = App.ServiceConfigProperty.create(_config);
+        this.updateHostOverrides(serviceConfigProperty, _config);
+        if (!storedConfigs && !serviceConfigProperty.get('hasInitialValue')) {
+          configPropertyHelper.initialValue(serviceConfigProperty, localDB, configs);
+        }
+        serviceConfigProperty.validate();
+        configsByService.pushObject(serviceConfigProperty);
+      }, this);
+      var serviceConfig = App.config.createServiceConfig(service.get('serviceName'));
+      serviceConfig.set('showConfig', service.get('showConfig'));
+      serviceConfig.set('configs', configsByService);
+      if (['addServiceController', 'installerController'].contains(this.get('wizardController.name')))
{
+        this.addHostNamesToConfigs(serviceConfig, localDB.masterComponentHosts, localDB.slaveComponentHosts);
+      }
+      renderedServiceConfigs.push(serviceConfig);
+    }, this);
+    return renderedServiceConfigs;
+  },
+
+  /**
+   * Add host name properties to appropriate categories (for installer only)
+   * @param serviceConfig
+   * @param masterComponents
+   * @param slaveComponents
+   */
+  addHostNamesToConfigs: function(serviceConfig, masterComponents, slaveComponents) {
+    serviceConfig.get('configCategories').forEach(function(c) {
+      if (c.showHost) {
+        var value = [];
+        var componentName = c.name;
+        var masters = masterComponents.filterProperty('component', componentName);
+        if (masters.length) {
+          value = masters.mapProperty('hostName');
+        } else {
+          var slaves = slaveComponents.findProperty('componentName', componentName);
+          if (slaves) {
+            value = slaves.hosts.mapProperty('hostName');
+          }
+        }
+        var stackComponent = App.StackServiceComponent.find(componentName);
+        var hProperty = App.config.createHostNameProperty(serviceConfig.get('serviceName'),
componentName, value, stackComponent);
+        serviceConfig.get('configs').push(App.ServiceConfigProperty.create(hProperty));
+      }
+    }, this);
+  },
+
+  /**
+   * create new child configs from overrides, attach them to parent config
+   * override - value of config, related to particular host(s)
+   * @param configProperty
+   * @param storedConfigProperty
+   */
+  updateHostOverrides: function (configProperty, storedConfigProperty) {
+    if (storedConfigProperty.overrides != null && storedConfigProperty.overrides.length
> 0) {
+      var overrides = [];
+      storedConfigProperty.overrides.forEach(function (overrideEntry) {
+        // create new override with new value
+        var newSCP = App.ServiceConfigProperty.create(configProperty);
+        newSCP.set('value', overrideEntry.value);
+        newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
+        newSCP.set('parentSCP', configProperty);
+        overrides.pushObject(newSCP);
+      });
+      configProperty.set('overrides', overrides);
+    }
+  },
+
+  /**
    * When NameNode HA is enabled some configs based on <code>dfs.nameservices</code>
should be changed
    * This happens only if service is added AFTER NN HA is enabled
    *
@@ -891,7 +986,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     Em.keys(configsMap).forEach(function (filename) {
       Em.keys(configsMap[filename]).forEach(function (propertyName) {
         configs.push(configMixin.createDefaultConfig(propertyName,
-          configMixin.getServiceByConfigType(filename).get('serviceName'),
+          configMixin.getServiceByConfigType(filename) ? configMixin.getServiceByConfigType(filename).get('serviceName')
: 'MISC',
           configMixin.getOriginalFileName(filename),
           false, {
             value: configsMap[filename][propertyName],

http://git-wip-us.apache.org/repos/asf/ambari/blob/4f4959d2/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 5344fcb..51dfd8c 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -18,7 +18,6 @@
 
 var App = require('app');
 var stringUtils = require('utils/string_utils');
-var configPropertyHelper = require('utils/configs/config_property_helper');
 
 App.config = Em.Object.create({
 
@@ -581,98 +580,6 @@ App.config = Em.Object.create({
   },
 
   /**
-   * render configs, distribute them by service
-   * and wrap each in ServiceConfigProperty object
-   * @param configs
-   * @param storedConfigs
-   * @param allSelectedServiceNames
-   * @param installedServiceNames
-   * @param localDB
-   * @return {App.ServiceConfig[]}
-   */
-  renderConfigs: function (configs, storedConfigs, allSelectedServiceNames, installedServiceNames,
localDB) {
-    var renderedServiceConfigs = [];
-    var services = [];
-
-    this.get('preDefinedServiceConfigs').forEach(function (serviceConfig) {
-      var serviceName = serviceConfig.get('serviceName');
-      if (allSelectedServiceNames.contains(serviceName) || serviceName === 'MISC') {
-        if (!installedServiceNames.contains(serviceName) || serviceName === 'MISC') {
-          serviceConfig.set('showConfig', true);
-        }
-        services.push(serviceConfig);
-      }
-    });
-    services.forEach(function (service) {
-      var configsByService = [];
-      var serviceConfigs = configs.filterProperty('serviceName', service.get('serviceName'));
-      serviceConfigs.forEach(function (_config) {
-        var serviceConfigProperty = App.ServiceConfigProperty.create(_config);
-        this.updateHostOverrides(serviceConfigProperty, _config);
-        if (!storedConfigs && !serviceConfigProperty.get('hasInitialValue')) {
-          configPropertyHelper.initialValue(serviceConfigProperty, localDB, configs);
-        }
-        serviceConfigProperty.validate();
-        configsByService.pushObject(serviceConfigProperty);
-      }, this);
-      var serviceConfig = this.createServiceConfig(service.get('serviceName'));
-      serviceConfig.set('showConfig', service.get('showConfig'));
-      serviceConfig.set('configs', configsByService);
-      this.addHostNamesToConfigs(serviceConfig, localDB.masterComponentHosts, localDB.slaveComponentHosts);
-      renderedServiceConfigs.push(serviceConfig);
-    }, this);
-    return renderedServiceConfigs;
-  },
-
-  /**
-   * Add host name properties to appropriate categories (for installer only)
-   * @param serviceConfig
-   * @param masterComponents
-   * @param slaveComponents
-   */
-  addHostNamesToConfigs: function(serviceConfig, masterComponents, slaveComponents) {
-    serviceConfig.get('configCategories').forEach(function(c) {
-      if (c.showHost) {
-        var value = [];
-        var componentName = c.name;
-        var masters = masterComponents.filterProperty('component', componentName);
-        if (masters.length) {
-          value = masters.mapProperty('hostName');
-        } else {
-          var slaves = slaveComponents.findProperty('componentName', componentName);
-          if (slaves) {
-            value = slaves.hosts.mapProperty('hostName');
-          }
-        }
-        var stackComponent = App.StackServiceComponent.find(componentName);
-        var hProperty = this.createHostNameProperty(serviceConfig.get('serviceName'), componentName,
value, stackComponent);
-        serviceConfig.get('configs').push(App.ServiceConfigProperty.create(hProperty));
-      }
-    }, this);
-  },
-
-  /**
-   * create new child configs from overrides, attach them to parent config
-   * override - value of config, related to particular host(s)
-   * @param configProperty
-   * @param storedConfigProperty
-   */
-  updateHostOverrides: function (configProperty, storedConfigProperty) {
-    if (storedConfigProperty.overrides != null && storedConfigProperty.overrides.length
> 0) {
-      var overrides = [];
-      storedConfigProperty.overrides.forEach(function (overrideEntry) {
-        // create new override with new value
-        var newSCP = App.ServiceConfigProperty.create(configProperty);
-        newSCP.set('value', overrideEntry.value);
-        newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
-        newSCP.set('parentSCP', configProperty);
-        overrides.pushObject(newSCP);
-      });
-      configProperty.set('overrides', overrides);
-    }
-  },
-
-  /**
    * create new ServiceConfig object by service name
    * @param {string} serviceName
    * @param {App.ServiceConfigGroup[]} configGroups

http://git-wip-us.apache.org/repos/asf/ambari/blob/4f4959d2/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 6fd8e03..f59398f 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1145,15 +1145,15 @@ describe('App.InstallerStep7Controller', function () {
     });
 
     afterEach(function () {
-      App.config.renderConfigs.restore();
+      installerStep7Controller.renderConfigs.restore();
     });
 
-    it('if wizard isn\'t addService, should set output of App.config.renderConfigs', function
() {
+    it('if wizard isn\'t addService, should set output of installerStep7Controller.renderConfigs',
function () {
       var serviceConfigs = Em.A([
         {serviceName:'HDFS', configs: []},
         {}
       ]);
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.set('wizardController.name', 'installerController');
@@ -1165,7 +1165,7 @@ describe('App.InstallerStep7Controller', function () {
       var serviceConfigs = Em.A([Em.Object.create({serviceName: 'HDFS', configs: []}), Em.Object.create({serviceName:
's2'})]);
       installerStep7Controller.set('wizardController.name', 'addServiceController');
       installerStep7Controller.reopen({selectedServiceNames: ['s2']});
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.setStepConfigs([], []);
@@ -1195,7 +1195,7 @@ describe('App.InstallerStep7Controller', function () {
       );
       installerStep7Controller.set('wizardController.name', 'addServiceController');
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.setStepConfigs([], []);
@@ -1223,7 +1223,7 @@ describe('App.InstallerStep7Controller', function () {
       );
 
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.setStepConfigs([], []);
@@ -1253,7 +1253,7 @@ describe('App.InstallerStep7Controller', function () {
 
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
       installerStep7Controller.set('installedServiceNames',['HDFS', 's2', 's3']);
-      sinon.stub(App.config, 'renderConfigs', function () {
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
         return serviceConfigs;
       });
       installerStep7Controller.setStepConfigs([], []);


Mime
View raw message