You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2015/06/19 19:57:59 UTC

ambari git commit: AMBARI-11925. Kerkeros Service Configs: KDC Type Value is corrupted (rlevas)

Repository: ambari
Updated Branches:
  refs/heads/trunk 0e2a40c09 -> cbc016073


AMBARI-11925. Kerkeros Service Configs: KDC Type Value is corrupted (rlevas)


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

Branch: refs/heads/trunk
Commit: cbc01607350fa2c219eebb56f5e631a79b902684
Parents: 0e2a40c
Author: Robert Levas <rl...@hortonworks.com>
Authored: Fri Jun 19 13:57:55 2015 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jun 19 13:57:55 2015 -0400

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 20 ++++++++++++
 .../app/mixins/common/configs/configs_saver.js  |  2 +-
 .../models/configs/objects/service_config.js    | 34 +++++++++++++++++---
 3 files changed, 51 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cbc01607/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 6ceb89d..8a05117 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -402,6 +402,26 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
   },
 
   /**
+   * revert certain config values to their innital value
+   * i.e. don't save the KDC Type as "Existing MIT KDC", instead save it as mit-kdc
+   */
+  configValueRevert: function () {
+    var stepConfigs = this.get('stepConfigs').findProperty('serviceName', this.get('content.serviceName'));
+    if (!stepConfigs) { return; }
+
+    var configs = stepConfigs.configs;
+    if (configs) {
+      var kdc_type = configs.findProperty('name', 'kdc_type');
+
+      if (!kdc_type) { return; };
+      if (App.router.get('mainAdminKerberosController.kdcTypesValues')[kdc_type.get('value')]) { return; }
+
+      kdc_type.set('value', kdc_type.get('savedValue'));
+    }
+
+  }.observes('saveInProgress'),
+
+  /**
    * adds properties form stack that doesn't belong to cluster
    * to step configs
    * also set recommended value if isn't exists

http://git-wip-us.apache.org/repos/asf/ambari/blob/cbc01607/ambari-web/app/mixins/common/configs/configs_saver.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/configs_saver.js b/ambari-web/app/mixins/common/configs/configs_saver.js
index 882db86..bd95292 100644
--- a/ambari-web/app/mixins/common/configs/configs_saver.js
+++ b/ambari-web/app/mixins/common/configs/configs_saver.js
@@ -958,7 +958,7 @@ App.ConfigsSaverMixin = Em.Mixin.create({
    */
 
   /**
-   * filter out unchanged configurations
+   * filter out unchanged configurationsisPropertiesChanged
    * @param {Array} configsToSave
    * @private
    * @method filterChangedConfiguration

http://git-wip-us.apache.org/repos/asf/ambari/blob/cbc01607/ambari-web/app/models/configs/objects/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config.js b/ambari-web/app/models/configs/objects/service_config.js
index b131c71..b1a1d43 100644
--- a/ambari-web/app/models/configs/objects/service_config.js
+++ b/ambari-web/app/models/configs/objects/service_config.js
@@ -62,12 +62,38 @@ App.ServiceConfig = Ember.Object.extend({
     return masterErrors + slaveErrors + overrideErrors + enhancedConfigsErrors;
   }.property('configs.@each.isValid', 'configs.@each.isVisible', 'configCategories.@each.slaveErrorCount', 'configs.@each.overrideErrorTrigger'),
 
+  /**
+   * checks if for example for kdc_type, the value isn't just the pretty version of the saved value, for example mit-kdc
+   * and Existing MIT KDC are the same value, but they are interpreted as being changed. This function fixes that
+   * @param configs
+   * @returns {boolean} - checks
+   */
+  checkDefaultValues: function (configs) {
+    var kdcType = configs.findProperty('name', 'kdc_type');
+
+    if (!kdcType) {
+      return true;
+    }
+
+    // if there is only one value changed and that value is for kdc_type, check if the value has really changed or just
+    // the string shown to the user is different
+    if (configs.filterProperty('isNotDefaultValue').length === 1) {
+      if (configs.findProperty('isNotDefaultValue', true) === kdcType) {
+        return App.router.get('mainAdminKerberosController.kdcTypesValues')[kdcType.get('savedValue')] !== kdcType.get('value');
+      }
+    }
+
+    return true;
+  },
+
   isPropertiesChanged: function() {
     var requiredByAgent = this.get('configs').filterProperty('isRequiredByAgent');
-    return requiredByAgent.someProperty('isNotSaved') ||
-           requiredByAgent.someProperty('isNotDefaultValue') ||
-           requiredByAgent.someProperty('isOverrideChanged') ||
-           this.get('configs.length') !== this.get('initConfigsLength');
+    var isNotSaved = requiredByAgent.someProperty('isNotSaved');
+    var isNotDefaultValue = this.checkDefaultValues(requiredByAgent);
+    var isOverrideChanged = requiredByAgent.someProperty('isOverrideChanged');
+    var differentConfigLengths = this.get('configs.length') !== this.get('initConfigsLength');
+
+    return  isNotSaved || isNotDefaultValue || isOverrideChanged || differentConfigLengths;
   }.property('configs.@each.isNotDefaultValue', 'configs.@each.isOverrideChanged', 'configs.length', 'configs.@each.isNotSaved', 'initConfigsLength'),
 
   init: function() {