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

[1/2] ambari git commit: AMBARI-11745. 'yarn.admin.acl' have default value of 'yarn', and should be updated when 'yarn_user' is changed

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 b1204e543 -> 74d73d662


AMBARI-11745. 'yarn.admin.acl' have default value of 'yarn', and should be updated when 'yarn_user' is changed


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

Branch: refs/heads/branch-2.1
Commit: 814800a54a81fdac4721a21ec58ce9e8e4429fb9
Parents: b1204e5
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Fri Jun 5 17:34:13 2015 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Fri Jun 5 19:08:26 2015 -0700

----------------------------------------------------------------------
 .../services/YARN/configuration/yarn-site.xml   |   6 +
 ambari-web/app/assets/test/tests.js             |   1 +
 .../utils/configs/modification_handlers/misc.js |  47 +++++++-
 .../configs/service_configs_by_category_view.js |   2 +-
 .../configs/modification_handlers/misc_test.js  | 112 +++++++++++++++++++
 5 files changed, 163 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/814800a5/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml
index 58c817f..f2774fc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/configuration/yarn-site.xml
@@ -31,4 +31,10 @@
     <value>true</value>
   </property>
 
+  <property>
+    <name>yarn.admin.acl</name>
+    <value>yarn</value>
+    <description> ACL of who can be admin of the YARN cluster. </description>
+  </property>
+
 </configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/814800a5/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 1be092c..7338dbf 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -172,6 +172,7 @@ var files = ['test/init_model_test',
   'test/utils/configs/database_test',
   'test/utils/configs/config_property_helper_test',
   'test/utils/configs/modification_handlers/modification_handler_test',
+  'test/utils/configs/modification_handlers/misc_test',
   'test/views/common/chart/linear_time_test',
   'test/views/common/configs/widgets/combo_config_widget_view_test',
   'test/views/common/configs/widgets/config_widget_view_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/814800a5/ambari-web/app/utils/configs/modification_handlers/misc.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/modification_handlers/misc.js b/ambari-web/app/utils/configs/modification_handlers/misc.js
index 42decb5..2af27ef 100644
--- a/ambari-web/app/utils/configs/modification_handlers/misc.js
+++ b/ambari-web/app/utils/configs/modification_handlers/misc.js
@@ -53,11 +53,50 @@ module.exports = App.ServiceConfigModificationHandler.create({
           filename : 'hdfs-site.xml'
         });
       }
+    } else if (changedConfig.get("name") == "yarn_user") {
+      curConfigs = allConfigs.findProperty('serviceName', 'YARN').get('configs');
+      var currentUsers,
+          currentGroups;
+      var initialUser = changedConfig.get('initialValue');
+      var newUser = newValue;
+      var currentAclValue = curConfigs.findProperty("name", "yarn.admin.acl").get("value");
+      var currentAclValueSplits = $.trim(currentAclValue).split(/\s+/).filter(function(i) { return !Em.isEmpty(i); });
+      if (currentAclValueSplits.length == 2) {
+        currentUsers = currentAclValueSplits[0];
+        currentGroups = currentAclValueSplits[1];
+      } else {
+        currentUsers = currentAclValueSplits.length > 0 ? currentAclValueSplits.shift() : ''
+        currentGroups = currentAclValueSplits.join(" ");
+      }
+      var currentUserList = currentUsers.split(',').filter(function(i) { return !Em.isEmpty(i); });
+      if (!currentUserList.contains(newUser)) {
+        var currentUserIndex = currentUserList.indexOf(initialUser);
+        if (currentUserIndex > -1) {
+          currentUserList.splice(currentUserIndex, 1);
+        }
+        if (!currentUserList.contains(newUser)) {
+          currentUserList.push(newUser);
+        }
+        var newAclValue = $.trim(currentUserList.join(',') + ' ' + currentGroups);
+        if (currentAclValue != newAclValue) {
+          affectedProperties.push({
+            serviceName : "YARN",
+            sourceServiceName : "MISC",
+            propertyName : "yarn.admin.acl",
+            propertyDisplayName : "yarn.admin.acl",
+            newValue : newAclValue,
+            curValue : currentAclValue,
+            changedPropertyName : "yarn_user",
+            remove : false,
+            filename : 'yarn-site.xml'
+          });
+        }
+      }
     } else if (changedConfig.get("name") == "user_group") {
-      if (!(selectedServices.indexOf("YARN") >= 0)) {
-        return;
+      if (!selectedServices.contains('YARN')) {
+        return [];
       }
-      if (selectedServices.indexOf("MAPREDUCE2") >= 0) {
+      if (selectedServices.contains("MAPREDUCE2")) {
         curConfigs = allConfigs.findProperty("serviceName", "MAPREDUCE2").get("configs");
         if ($.trim(newValue) != $.trim(curConfigs.findProperty("name", "mapreduce.cluster.administrators").get("value"))) {
           affectedProperties.push({
@@ -72,7 +111,7 @@ module.exports = App.ServiceConfigModificationHandler.create({
           });
         }
       }
-      if (selectedServices.indexOf("YARN") >= 0) {
+      if (selectedServices.contains("YARN")) {
         curConfigs = allConfigs.findProperty("serviceName", "YARN").get("configs");
         if (newValue != curConfigs.findProperty("name", "yarn.nodemanager.linux-container-executor.group").get("value")) {
           affectedProperties.push({

http://git-wip-us.apache.org/repos/asf/ambari/blob/814800a5/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 1d5e730..47722e1 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -187,7 +187,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
           var affected = self.get("newAffectedProperties").objectAt(0),
             changedProperty = self.get("controller.stepConfigs").findProperty("serviceName", affected.sourceServiceName)
               .get("configs").findProperty("name", affected.changedPropertyName);
-          changedProperty.set('value', changedProperty.get('savedValue'));
+          changedProperty.set('value', changedProperty.get('savedValue') || changedProperty.get('initialValue'));
           self.get("controller").set("miscModalVisible", false);
           this.hide();
         },

http://git-wip-us.apache.org/repos/asf/ambari/blob/814800a5/ambari-web/test/utils/configs/modification_handlers/misc_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/modification_handlers/misc_test.js b/ambari-web/test/utils/configs/modification_handlers/misc_test.js
new file mode 100644
index 0000000..d51b2ca
--- /dev/null
+++ b/ambari-web/test/utils/configs/modification_handlers/misc_test.js
@@ -0,0 +1,112 @@
+/**
+ * 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.
+ */
+
+
+require('utils/configs/modification_handlers/modification_handler');
+
+var App = require('app');
+
+describe('#App.ServiceConfigModificationHandler MISC', function() {
+  var genStepConfig = function(serviceName, properties) {
+    return Em.Object.create({
+      serviceName: serviceName,
+      configs: properties
+    });
+  };
+  var genProperty = function(propName, value, initialValue, filename) {
+    return Em.Object.create({
+      name: propName,
+      value: value,
+      initialValue: initialValue,
+      filename: filename
+    });
+  };
+  var genProperties = function(properties) {
+    return properties.map(function(item) {
+      return genProperty.apply(undefined, item);
+    });
+  };
+  var handler = require('utils/configs/modification_handlers/misc');
+
+  describe('#getDependentConfigChanges', function() {
+
+    describe('YARN dependent configs', function() {
+      var tests = [
+        {
+          miscHandlerParams: {
+            changedConfig: genProperty('yarn_user', 'new-user', 'initial-user', 'yarn-env.xml'),
+            selectedServices: ['HDFS', 'YARN', 'MAPREDUCE2', 'ZOOKEEPER'],
+            allConfigs: [
+              genStepConfig('YARN', genProperties([
+                ['yarn.admin.acl', 'some-user2 some-group2', '', 'yarn-site.xml']
+              ])),
+              genStepConfig('MISC', genProperties([
+                ['user_group', 'some-group', 'initial-group', 'cluster-env.xml'],
+                ['yarn_user', 'new-user', 'initial-user', 'yarn-env.xml']
+              ]))
+            ]
+          },
+          m: 'yarn_user changed, yarn.admin.acl new user name should be appended to users joined joined comma',
+          e: { propertyName: 'yarn.admin.acl', curValue: 'some-user2 some-group2', newValue: 'some-user2,new-user some-group2'}
+        },
+        {
+          miscHandlerParams: {
+            changedConfig: genProperty('yarn_user', 'new-user', 'initial-user', 'yarn-env.xml'),
+            selectedServices: ['HDFS', 'YARN', 'MAPREDUCE2', 'ZOOKEEPER'],
+            allConfigs: [
+              genStepConfig('YARN', genProperties([
+                ['yarn.admin.acl', 'initial-user some-group2', '', 'yarn-site.xml']
+              ])),
+              genStepConfig('MISC', genProperties([
+                ['user_group', 'some-group', 'initial-group', 'cluster-env.xml'],
+                ['yarn_user', 'some-user', 'initial-user', 'yarn-env.xml']
+              ]))
+            ]
+          },
+          m: 'yarn_user changed, yarn.admin.acl initial user name should be update with new one',
+          e: { propertyName: 'yarn.admin.acl', curValue: 'initial-user some-group2', newValue: 'new-user some-group2'}
+        },
+        {
+          miscHandlerParams: {
+            changedConfig: genProperty('yarn_user', 'new-user', 'initial-user', 'yarn-env.xml'),
+            selectedServices: ['HDFS', 'YARN', 'MAPREDUCE2', 'ZOOKEEPER'],
+            allConfigs: [
+              genStepConfig('YARN', genProperties([
+                ['yarn.admin.acl', '', '', 'yarn-site.xml']
+              ])),
+              genStepConfig('MISC', genProperties([
+                ['user_group', 'some-group', 'initial-group', 'cluster-env.xml'],
+                ['yarn_user', 'new-user', 'initial-user', 'yarn-env.xml']
+              ]))
+            ]
+          },
+          m: 'yarn_user changed, yarn.admin.acl initial value is not in valid format its value should be set with yarn_user and user_group',
+          e: { propertyName: 'yarn.admin.acl', curValue: '', newValue: 'new-user'}
+        }
+      ];
+
+      tests.forEach(function(test) {
+        it(test.m, function() {
+          var handlerParams = test.miscHandlerParams;
+          var result = handler.getDependentConfigChanges(handlerParams.changedConfig, handlerParams.selectedServices, handlerParams.allConfigs, false).toArray();
+          // check the key => value according test.e from result
+          expect(App.permit(result.findProperty('propertyName', test.e.propertyName), Em.keys(test.e))).to.eql(test.e);
+        });
+      });
+    });
+  });
+});


[2/2] ambari git commit: AMBARI-11748. 'hbase.region.server.rpc.scheduler.factory.class' has been misspelt (srimanth)

Posted by sr...@apache.org.
AMBARI-11748. 'hbase.region.server.rpc.scheduler.factory.class' has been misspelt (srimanth)


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

Branch: refs/heads/branch-2.1
Commit: 74d73d66236a1772ce76d141ed002f4c372138c1
Parents: 814800a
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Fri Jun 5 19:08:20 2015 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Fri Jun 5 19:08:27 2015 -0700

----------------------------------------------------------------------
 .../stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml   | 2 +-
 ambari-web/app/data/HDP2.2/site_properties.js                    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/74d73d66/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
index 429b763..382608e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
@@ -126,7 +126,7 @@
     </depends-on>
   </property>
   <property>
-    <name>hbase.regionserver.rpc.scheduler.factory.class</name>
+    <name>hbase.region.server.rpc.scheduler.factory.class</name>
     <value></value>
     <depends-on>
       <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/74d73d66/ambari-web/app/data/HDP2.2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.2/site_properties.js b/ambari-web/app/data/HDP2.2/site_properties.js
index f4be8c7..f81cb0c 100644
--- a/ambari-web/app/data/HDP2.2/site_properties.js
+++ b/ambari-web/app/data/HDP2.2/site_properties.js
@@ -908,8 +908,8 @@ hdp22properties.push(
   },
   {
   "id": "site property",
-    "name": "hbase.regionserver.rpc.scheduler.factory.class",
-    "displayName": "hbase.regionserver.rpc.scheduler.factory.class",
+    "name": "hbase.region.server.rpc.scheduler.factory.class",
+    "displayName": "hbase.region.server.rpc.scheduler.factory.class",
     "defaultValue": "",
     "isRequired": false,
     "category": "Advanced hbase-site",