You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/02/02 12:32:49 UTC
[2/2] ambari git commit: AMBARI-9422. Group Add In Any Hooks Fail
Because of Invalid Group Name after Upgrade (aonishuk)
AMBARI-9422. Group Add In Any Hooks Fail Because of Invalid Group Name after Upgrade (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a0284cc3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a0284cc3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a0284cc3
Branch: refs/heads/trunk
Commit: a0284cc33fa9a22359953103c0516222acb3757e
Parents: 31243e4
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Feb 2 13:32:45 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Feb 2 13:32:45 2015 +0200
----------------------------------------------------------------------
.../server/upgrade/UpgradeCatalog200.java | 35 ++++++++++++++++++++
.../server/upgrade/UpgradeCatalog200Test.java | 6 ++++
2 files changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a0284cc3/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
index a8b3fc3..a83d26d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
@@ -282,9 +282,44 @@ public class UpgradeCatalog200 extends AbstractUpgradeCatalog {
// remove NAGIOS to make way for the new embedded alert framework
removeNagiosService();
addNewConfigurationsFromXml();
+ updateDfsClusterAdmintistratorsProperty();
updateHiveDatabaseType();
setSecurityType();
}
+
+ protected void updateDfsClusterAdmintistratorsProperty() throws AmbariException {
+ /*
+ * Remove trailing and leading whitespaces from hdfs-site/dfs.cluster.administrators
+ * property.
+ */
+ AmbariManagementController ambariManagementController = injector.getInstance(
+ AmbariManagementController.class);
+ Clusters clusters = ambariManagementController.getClusters();
+
+ if (clusters != null) {
+ Map<String, Cluster> clusterMap = clusters.getClusters();
+ Map<String, String> prop = new HashMap<String, String>();
+ String properyValue = null;
+
+ if (clusterMap != null && !clusterMap.isEmpty()) {
+ for (final Cluster cluster : clusterMap.values()) {
+ properyValue = null;
+ if (cluster.getDesiredConfigByType("hdfs-site") != null) {
+ properyValue = cluster.getDesiredConfigByType(
+ "hdfs-site").getProperties().get("dfs.cluster.administrators");
+ }
+
+ if (properyValue != null) {
+ properyValue = properyValue.trim();
+
+ prop.put("dfs.cluster.administrators", properyValue);
+ updateConfigurationPropertiesForCluster(cluster, "hdfs-site",
+ prop, true, false);
+ }
+ }
+ }
+ }
+ }
protected void updateHiveDatabaseType() throws AmbariException {
final String PROPERTY_NAME = "hive_database_type";
http://git-wip-us.apache.org/repos/asf/ambari/blob/a0284cc3/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
index d6f9e6e..b935c29 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java
@@ -307,18 +307,24 @@ public class UpgradeCatalog200Test {
Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod
("addNewConfigurationsFromXml");
Method setSecurityType = UpgradeCatalog200.class.getDeclaredMethod("setSecurityType");
+ Method updateDfsClusterAdmintistratorsProperty = UpgradeCatalog200.class.getDeclaredMethod("updateDfsClusterAdmintistratorsProperty");
UpgradeCatalog200 upgradeCatalog = createMockBuilder(UpgradeCatalog200.class)
.addMockedMethod(removeNagiosService)
.addMockedMethod(updateHiveDatabaseType)
.addMockedMethod(addNewConfigurationsFromXml)
.addMockedMethod(setSecurityType)
+ .addMockedMethod(updateDfsClusterAdmintistratorsProperty)
.createMock();
upgradeCatalog.removeNagiosService();
expectLastCall().once();
upgradeCatalog.addNewConfigurationsFromXml();
expectLastCall();
+
+ upgradeCatalog.updateDfsClusterAdmintistratorsProperty();
+ expectLastCall();
+
upgradeCatalog.updateHiveDatabaseType();
expectLastCall().once();
upgradeCatalog.setSecurityType();