ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject ambari git commit: AMBARI-12513 Restore configs on 7 step of installer from stored configs without merging with predefined. (ababiichuk)
Date Thu, 23 Jul 2015 12:24:59 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 097fffa34 -> b8d2b2b64


AMBARI-12513 Restore configs on 7 step of installer from stored configs without merging with
predefined. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: b8d2b2b64e492ea6d7b93c03c3abade3f6a4ce05
Parents: 097fffa
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Thu Jul 23 15:20:42 2015 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Thu Jul 23 15:20:42 2015 +0300

----------------------------------------------------------------------
 .../main/admin/kerberos/step2_controller.js     |  7 +-
 ambari-web/app/controllers/wizard.js            | 26 +------
 .../app/controllers/wizard/step7_controller.js  | 68 +++++++-----------
 ambari-web/app/data/HDP2.3/site_properties.js   |  3 +-
 ambari-web/app/utils/config.js                  | 73 +++++---------------
 .../test/controllers/wizard/step7_test.js       |  6 +-
 ambari-web/test/utils/config_test.js            | 17 +----
 7 files changed, 53 insertions(+), 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d2b2b6/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
index aecad01..18b714b 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
@@ -86,15 +86,10 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
       return;
     }
     this.clearStep();
-    //STEP 1: Load advanced configs
-    var advancedConfigs = App.StackConfigProperty.find();
     //STEP 2: Load on-site configs by service from local DB
     var storedConfigs = this.get('content.serviceConfigProperties');
     //STEP 3: Merge pre-defined configs with loaded on-site configs
-    this.set('configs', App.config.mergePreDefinedWithStored(
-      storedConfigs,
-      advancedConfigs,
-      this.get('selectedServiceNames')));
+    this.set('configs', App.config.mergePreDefinedWithStack(this.get('selectedServiceNames')));
     App.config.setPreDefinedServiceConfigs(this.get('addMiscTabToPage'));
 
     this.filterConfigs(this.get('configs'));

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d2b2b6/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 33982f3..d4cc630 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -856,30 +856,8 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
       }
 
       _content.get('configs').forEach(function (_configProperties) {
-        var configProperty = {
-          id: _configProperties.get('id'),
-          name: _configProperties.get('name'),
-          displayName: _configProperties.get('displayName'),
-          value: _configProperties.get('value'),
-          savedValue: _configProperties.get('savedValue'),
-          recommendedValue: _configProperties.get('recommendedValue'),
-          description: _configProperties.get('description'),
-          serviceName: _configProperties.get('serviceName'),
-          domain: _configProperties.get('domain'),
-          isVisible: _configProperties.get('isVisible'),
-          isFinal: _configProperties.get('isFinal'),
-          recommendedIsFinal: _configProperties.get('isFinal'),
-          supportsFinal: _configProperties.get('supportsFinal'),
-          filename: _configProperties.get('filename'),
-          displayType: _configProperties.get('displayType'),
-          isRequiredByAgent: _configProperties.get('isRequiredByAgent'),
-          hasInitialValue: !!_configProperties.get('hasInitialValue'),
-          isRequired: _configProperties.get('isRequired'), // flag that allow saving property
with empty value
-          group: !!_configProperties.get('group') ? _configProperties.get('group.name') :
null,
-          showLabel: _configProperties.get('showLabel'),
-          category: _configProperties.get('category'),
-          configId: App.config.configId(_configProperties.get('name'),_configProperties.get('filename'))
-        };
+        var configProperty = App.config.createDefaultConfig(_configProperties.get('name'),
_configProperties.get('filename'), _configProperties.get('isUserProperty'), {value: _configProperties.get('value')});
+        configProperty = App.config.mergeStaticProperties(configProperty, _configProperties,
['name', 'filename']);
 
         if (this.isExcludedConfig(configProperty)) {
           configProperty.value = '';

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d2b2b6/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 ab205a7..4d13b5b 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -620,16 +620,12 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     this.clearStep();
 
     var self = this;
-    //STEP 1: Load advanced configs
-    var advancedConfigs = App.StackConfigProperty.find();
     //STEP 2: Load on-site configs by service from local DB
     var storedConfigs = this.get('content.serviceConfigProperties');
     //STEP 3: Merge pre-defined configs with loaded on-site configs
-    var configs = App.config.mergePreDefinedWithStored(
-      storedConfigs,
-      advancedConfigs,
-      this.get('selectedServiceNames').concat(this.get('installedServiceNames'))
-    );
+    var configs = (storedConfigs && storedConfigs.length)
+      ? storedConfigs
+      : App.config.mergePreDefinedWithStack(this.get('selectedServiceNames').concat(this.get('installedServiceNames')));
     App.config.setPreDefinedServiceConfigs(this.get('addMiscTabToPage'));
 
     this.set('groupsToDelete', this.get('wizardController').getDBProperty('groupsToDelete')
|| []);
@@ -662,51 +658,37 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     this.activateSpecialConfigs();
     this.selectProperService();
     var self = this;
-    this.loadServerSideConfigsRecommendations().always(function () {
-      // format descriptor configs
-      var serviceConfigPropertiesNames = (self.get('content.serviceConfigProperties') ||
[]).mapProperty('name'),
-       serviceConfigPropertiesFileNames = (self.get('content.serviceConfigProperties') ||
[]).mapProperty('filename'),
-       recommendedToDelete = self.get('_dependentConfigValues').filterProperty('toDelete');
-      recommendedToDelete.forEach(function (c) {
-        var name = Em.get(c, 'propertyName'),
-         filename = Em.get(c, 'fileName');
-        if (serviceConfigPropertiesNames.contains(name) && serviceConfigPropertiesFileNames.contains(filename))
{
-          Em.set(c, 'toDelete', false);
-        }
-      });
-
-      var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER');
-      if (rangerService && !rangerService.get('isInstalled') && !rangerService.get('isSelected'))
{
-        App.config.removeRangerConfigs(self.get('stepConfigs'));
-      }
-      if (!self.get('content.serviceConfigProperties.length')) {
-        // for Add Service just remove or add dependent properties and ignore config values
changes
-        // for installed services only
+    var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER');
+    if (rangerService && !rangerService.get('isInstalled') && !rangerService.get('isSelected'))
{
+      App.config.removeRangerConfigs(self.get('stepConfigs'));
+    }
+    if (this.get('content.serviceConfigProperties.length') > 0) {
+      this.completeConfigLoading();
+    } else {
+      this.loadServerSideConfigsRecommendations().always(function () {
         if (self.get('wizardController.name') == 'addServiceController') {
+          // for Add Service just remove or add dependent properties and ignore config values
changes
+          // for installed services only
           self.addRemoveDependentConfigs(self.get('installedServiceNames'));
           self.clearDependenciesForInstalledServices(self.get('installedServiceNames'), self.get('stepConfigs'));
         }
         // * add dependencies based on recommendations
         // * update config values with recommended
-        // * remove properties recieved from recommendations
+        // * remove properties received from recommendations
         self.updateDependentConfigs();
-      } else {
-        // control flow for managing dependencies for stored configs,
-        // * Don't update values with recommended to save user's input
-        // * add dependencies based on user's input for parent configs
-        // * remove dependencies based on user's input for parent configs
-        self.addRemoveDependentConfigs();
-      }
-      self.restoreRecommendedConfigs();
-      self.clearDependentConfigsByService(App.StackService.find().filterProperty('isSelected').mapProperty('serviceName'));
-      self.set('isRecommendedLoaded', true);
-      if (self.get('content.skipConfigStep')) {
-        App.router.send('next');
-      }
-      self.set('hash', self.getHash());
-    });
+        self.completeConfigLoading();
+      });
+    }
   },
 
+  completeConfigLoading: function() {
+    this.clearDependentConfigsByService(App.StackService.find().filterProperty('isSelected').mapProperty('serviceName'));
+    this.set('isRecommendedLoaded', true);
+    if (this.get('content.skipConfigStep')) {
+      App.router.send('next');
+    }
+    this.set('hash', this.getHash());
+  },
   /**
    * After user navigates back to step7, values for depended configs should be set to values
set by user and not to default values
    * @method restoreRecommendedConfigs

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d2b2b6/ambari-web/app/data/HDP2.3/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.3/site_properties.js b/ambari-web/app/data/HDP2.3/site_properties.js
index 0b86817..ba09879 100644
--- a/ambari-web/app/data/HDP2.3/site_properties.js
+++ b/ambari-web/app/data/HDP2.3/site_properties.js
@@ -46,7 +46,8 @@ var excludedConfigs = [
   'hbase.regionserver.global.memstore.upperLimit',
   "port",
   "hive.metastore.heapsize",
-  "hive.client.heapsize"
+  "hive.client.heapsize",
+  "SQL_COMMAND_INVOKER"
 ];
 
 var hdp23properties = hdp22properties.filter(function (item) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d2b2b6/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 4feb576..fd3847a 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -370,12 +370,12 @@ App.config = Em.Object.create({
       isVisible: true,
       isUserProperty: !definedInStack,
       isRequired: definedInStack,
+      group: null,
       id: 'site property',
       isRequiredByAgent:  true,
       isReconfigurable: true,
       isObserved: false,
       unit: null,
-      overrides: null,
       hasInitialValue: false,
       isOverridable: true,
       index: null,
@@ -390,12 +390,12 @@ App.config = Em.Object.create({
    * This method merge properties form <code>stackConfigProperty<code> which
are taken from stack
    * with <code>UIConfigProperty<code> which are hardcoded on UI
    * @param coreObject
-   * @param preDefined
    * @param stackProperty
+   * @param preDefined
    * @param [propertiesToSkip]
    * @param [preDefinedOnly]
    */
-  mergeStaticProperties: function(coreObject, preDefined, stackProperty, propertiesToSkip,
preDefinedOnly) {
+  mergeStaticProperties: function(coreObject, stackProperty, preDefined, propertiesToSkip,
preDefinedOnly) {
     propertiesToSkip = propertiesToSkip || ['name', 'filename', 'value', 'savedValue', 'isFinal',
'savedIsFinal'];
     preDefinedOnly = preDefinedOnly || ['id'];
     for (var k in coreObject) {
@@ -581,16 +581,11 @@ App.config = Em.Object.create({
 
   /**
    * merge stored configs with pre-defined
-   * @param storedConfigs
-   * @param advancedConfigs
-   * @param selectedServiceNames
    * @return {Array}
    */
-  mergePreDefinedWithStored: function (storedConfigs, advancedConfigs, selectedServiceNames)
{
+  mergePreDefinedWithStack: function (selectedServiceNames) {
     var mergedConfigs = [];
 
-    storedConfigs = (storedConfigs) ? storedConfigs : [];
-
     var configTypes = App.StackService.find().filter(function(service) {
       return selectedServiceNames.contains(service.get('serviceName'));
     }).map(function(item) {
@@ -598,60 +593,30 @@ App.config = Em.Object.create({
     }).reduce(function(p,c) { return p.concat(c); }).concat(['cluster-env', 'alert_notification'])
       .uniq().compact().filter(function(configType) { return !!configType; });
 
-    var storedIds = storedConfigs.map(function(s) { return this.configId(s.name, s.filename);
}, this);
     var predefinedIds = Object.keys(this.get('preDefinedSitePropertiesMap'));
-    var stackIds = advancedConfigs.mapProperty('id');
+    var stackIds = App.StackConfigProperty.find().mapProperty('id');
 
-    var configIds = stackIds.concat(predefinedIds).concat(storedIds).uniq();
+    var configIds = stackIds.concat(predefinedIds).uniq();
 
     configIds.forEach(function(id) {
-      if (id) {
-        var stored = storedConfigs.findProperty('configId', id);
-        var preDefined = this.get('preDefinedSitePropertiesMap')[id];
-        var advanced = App.StackConfigProperty.find(id);
-
-        var name = this.getPropertyIfExists('name', stored && stored.name, advanced,
preDefined);
-        var filename = this.getPropertyIfExists('filename', stored && stored.filename,
advanced, preDefined);
-        if (configTypes.contains(this.getConfigTagFromFileName(filename))) {
-
-          var isAdvanced = advanced.get('id');
-          var core = stored || { value: this.getPropertyIfExists('value', '', advanced, preDefined),
isFinal: this.getPropertyIfExists('isFinal', false, advanced, preDefined)};
-          var configData = this.createDefaultConfig(name, filename, isAdvanced || !!preDefined,
core);
-
-          if (preDefined && !stored) {
-            // skip property if predefined config doesn't exist or ignored in stack property
definition for current stack.
-            // if `isRequiredByAgent` is set to `false` then this property used by UI only
to display properties like
-            // host names or some misc properties that won't be persisted.
-            if (Em.get(preDefined, 'isRequiredByAgent') !== false && !isAdvanced
&&
-             filename != 'alert_notification' && advanced.get('serviceName') != 'MISC'
&&
-              !['hive_hostname',
-                'oozie_hostname',
-                'hive_existing_oracle_host',
-                'hive_existing_postgresql_host',
-                'hive_existing_mysql_host',
-                'hive_existing_mssql_server_host',
-                'hive_existing_mssql_server_2_host',
-                'oozie_existing_oracle_host',
-                'oozie_existing_postgresql_host',
-                'oozie_existing_mysql_host',
-                'oozie_existing_mssql_server_host',
-                'oozie_existing_mssql_server_2_host'
-              ].contains(Em.get(preDefined, 'name'))) {
-              return;
-            }
-          }
 
-          configData = this.mergeStaticProperties(configData, preDefined, isAdvanced ? advanced
: null);
+      var preDefined = this.get('preDefinedSitePropertiesMap')[id];
+      var advanced = App.StackConfigProperty.find(id);
 
-          if (configData.displayType === 'password') {
-            configData.value = stored ? stored.value : configData.recommendedValue || '';
-          } else if (configData.displayType == 'directory' || configData.displayType == 'directories')
{
-            configData.value = configData.recommendedValue || configData.defaultDirectory
|| '';
-          }
+      var name = preDefined ? preDefined.name : advanced.get('name');
+      var filename = preDefined ? preDefined.filename : advanced.get('filename');
+      if (configTypes.contains(this.getConfigTagFromFileName(filename))) {
+        var configData = this.createDefaultConfig(name, filename, true, preDefined || {});
+
+        configData = this.mergeStaticProperties(configData, advanced.get('id') ? advanced
: null, null, ['name', 'filename']);
 
-          mergedConfigs.push(configData);
+        if (['directory' ,'directories'].contains(configData.displayType)) {
+          configData.value = configData.recommendedValue || configData.defaultDirectory ||
'';
         }
+
+        mergedConfigs.push(configData);
       }
+
     }, this);
     return mergedConfigs;
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d2b2b6/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 598a7e4..80433ab 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1390,7 +1390,7 @@ describe('App.InstallerStep7Controller', function () {
           stackConfigsLoaded: true
         })
       });
-      sinon.stub(App.config, 'mergePreDefinedWithStored', Em.K);
+      sinon.stub(App.config, 'mergePreDefinedWithStack', Em.K);
       sinon.stub(App.config, 'fileConfigsIntoTextarea', Em.K);
       sinon.stub(installerStep7Controller, 'clearStep', Em.K);
       sinon.stub(installerStep7Controller, 'getConfigTags', Em.K);
@@ -1404,7 +1404,7 @@ describe('App.InstallerStep7Controller', function () {
       sinon.stub(App.router, 'send', Em.K);
     });
     afterEach(function () {
-      App.config.mergePreDefinedWithStored.restore();
+      App.config.mergePreDefinedWithStack.restore();
       App.config.fileConfigsIntoTextarea.restore();
       installerStep7Controller.clearStep.restore();
       installerStep7Controller.getConfigTags.restore();
@@ -1428,7 +1428,7 @@ describe('App.InstallerStep7Controller', function () {
     });
     it('should use App.config to map configs', function () {
       installerStep7Controller.loadStep();
-      expect(App.config.mergePreDefinedWithStored.calledOnce).to.equal(true);
+      expect(App.config.mergePreDefinedWithStack.calledOnce).to.equal(true);
     });
     it('should call setInstalledServiceConfigs for addServiceController', function () {
       installerStep7Controller.set('wizardController.name', 'addServiceController');

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d2b2b6/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index 3689541..ad6cc7b 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -45,21 +45,6 @@ describe('App.config', function () {
     });
   };
 
-  var setupContentForMergeWithStored = function(context) {
-    loadServiceModelsData(context.installedServiceNames);
-    loadAllServicesConfigs(context);
-    setups.setupStackVersion(this, 'HDP-2.1');
-    context.result = App.config.mergePreDefinedWithStored(context.storedConfigs, modelSetup.setupAdvancedConfigsObject(),
context.installedServiceNames);
-  };
-
-  var removeServiceModelData = function(serviceIds) {
-    serviceIds.forEach(function(serviceId) {
-      var record = App.Service.find(serviceId);
-      record.deleteRecord();
-      record.get('stateManager').transitionTo('loading');
-    });
-  };
-
   describe('#handleSpecialProperties', function () {
     var config = {};
     it('value should be transformed to "1024" from "1024m"', function () {
@@ -1258,12 +1243,12 @@ describe('App.config', function () {
       isVisible: true,
       isUserProperty: false,
       isRequired: true,
+      group: null,
       id: 'site property',
       isRequiredByAgent:  true,
       isReconfigurable: true,
       isObserved: false,
       unit: null,
-      overrides: null,
       hasInitialValue: false,
       isOverridable: true,
       index: null,


Mime
View raw message