You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2015/06/02 15:04:00 UTC
[1/2] ambari git commit: AMBARI-11612. Changing only 'final' flag for
a config not being persisted by API (dlysnichenko)
Repository: ambari
Updated Branches:
refs/heads/trunk f4a6b76b6 -> 1bb0a8dad
AMBARI-11612. Changing only 'final' flag for a config not being persisted by API (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3bb7a6dc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3bb7a6dc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3bb7a6dc
Branch: refs/heads/trunk
Commit: 3bb7a6dc3a8fa45b589c171b0fe54a1beb0bd8a1
Parents: f4a6b76
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Tue Jun 2 16:02:57 2015 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Tue Jun 2 16:02:57 2015 +0300
----------------------------------------------------------------------
.../AmbariManagementControllerImpl.java | 49 ++++++++++++++++++++
.../AmbariManagementControllerTest.java | 22 +++++++++
2 files changed, 71 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3bb7a6dc/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index ad76ffa..d327d96 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1285,14 +1285,22 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
if (request.getDesiredConfig() != null) {
for (ConfigurationRequest desiredConfig : request.getDesiredConfig()) {
Map<String, String> requestConfigProperties = desiredConfig.getProperties();
+ Map<String,Map<String,String>> requestConfigAttributes = desiredConfig.getPropertiesAttributes();
Config clusterConfig = cluster.getDesiredConfigByType(desiredConfig.getType());
Map<String, String> clusterConfigProperties = null;
+ Map<String,Map<String,String>> clusterConfigAttributes = null;
if (clusterConfig != null) {
clusterConfigProperties = clusterConfig.getProperties();
+ clusterConfigAttributes = clusterConfig.getPropertiesAttributes();
+ if (!isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes)){
+ isConfigurationCreationNeeded = true;
+ break;
+ }
} else {
isConfigurationCreationNeeded = true;
break;
}
+
if (requestConfigProperties == null || requestConfigProperties.isEmpty()) {
Config existingConfig = cluster.getConfig(desiredConfig.getType(), desiredConfig.getVersionTag());
if (existingConfig != null) {
@@ -1491,6 +1499,47 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
/**
+ * Comparison of two attributes maps
+ * @param requestConfigAttributes - attribute map sent from API
+ * @param clusterConfigAttributes - existed attribute map
+ * @return true if maps is equal (have the same attributes and their values)
+ */
+ public boolean isAttributeMapsEqual(Map<String, Map<String, String>> requestConfigAttributes,
+ Map<String, Map<String, String>> clusterConfigAttributes) {
+ boolean isAttributesEqual = true;
+ if ((requestConfigAttributes != null && clusterConfigAttributes == null)
+ || (requestConfigAttributes == null && clusterConfigAttributes != null)
+ || (requestConfigAttributes != null && clusterConfigAttributes != null
+ && !requestConfigAttributes.keySet().equals(clusterConfigAttributes.keySet()))) {
+ return false;
+ } else if (clusterConfigAttributes != null && requestConfigAttributes != null) {
+ for (Entry<String, Map<String, String>> ClusterEntrySet : clusterConfigAttributes.entrySet()) {
+ Map<String, String> clusterMapAttributes = ClusterEntrySet.getValue();
+ Map<String, String> requestMapAttributes = requestConfigAttributes.get(ClusterEntrySet.getKey());
+ if ((requestMapAttributes != null && clusterMapAttributes == null)
+ || (requestMapAttributes == null && clusterMapAttributes != null)
+ || (requestMapAttributes != null && clusterMapAttributes != null
+ && !requestMapAttributes.keySet().equals(clusterMapAttributes.keySet()))) {
+ return false;
+ } else if (requestMapAttributes != null && clusterMapAttributes != null) {
+ for (Entry<String, String> requestPropertyEntrySet : requestMapAttributes.entrySet()) {
+ String requestPropertyValue = requestPropertyEntrySet.getValue();
+ String clusterPropertyValue = clusterMapAttributes.get(requestPropertyEntrySet.getKey());
+ if ((requestPropertyValue != null && clusterPropertyValue == null)
+ || (requestPropertyValue == null && clusterPropertyValue != null)
+ || (requestPropertyValue != null && clusterPropertyValue != null
+ && !requestPropertyValue.equals(clusterPropertyValue))) {
+ return false;
+ }
+ }
+ }
+
+ }
+ }
+ return isAttributesEqual;
+ }
+
+ /**
* Save cluster update results to retrieve later
* @param clusterRequest cluster request info
* @param clusterResponse cluster response info
http://git-wip-us.apache.org/repos/asf/ambari/blob/3bb7a6dc/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 1e4e332..58bdd64 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -10036,6 +10036,28 @@ public class AmbariManagementControllerTest {
}
@Test
+ public void testIsAttributeMapsEqual() {
+ AmbariManagementControllerImpl controllerImpl = null;
+ if (controller instanceof AmbariManagementControllerImpl){
+ controllerImpl = (AmbariManagementControllerImpl)controller;
+ }
+ Map<String, Map<String, String>> requestConfigAttributes = new HashMap<String, Map<String,String>>();
+ Map<String, Map<String, String>> clusterConfigAttributes = new HashMap<String, Map<String,String>>();
+ Assert.assertTrue(controllerImpl.isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes));
+ requestConfigAttributes.put("final", new HashMap<String, String>());
+ requestConfigAttributes.get("final").put("c", "true");
+ clusterConfigAttributes.put("final", new HashMap<String, String>());
+ clusterConfigAttributes.get("final").put("c", "true");
+ Assert.assertTrue(controllerImpl.isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes));
+ clusterConfigAttributes.put("final2", new HashMap<String, String>());
+ clusterConfigAttributes.get("final2").put("a", "true");
+ Assert.assertFalse(controllerImpl.isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes));
+ requestConfigAttributes.put("final2", new HashMap<String, String>());
+ requestConfigAttributes.get("final2").put("a", "false");
+ Assert.assertFalse(controllerImpl.isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes));
+ }
+
+ @Test
public void testEmptyConfigs() throws Exception {
String clusterName = "c1";
createCluster(clusterName);
[2/2] ambari git commit: AMBARI-11611. Delete incorrect Storm-HA
configs (dlysnichenko)
Posted by dm...@apache.org.
AMBARI-11611. Delete incorrect Storm-HA configs (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1bb0a8da
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1bb0a8da
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1bb0a8da
Branch: refs/heads/trunk
Commit: 1bb0a8dad6da296dd06cc3b998c974389b2e765f
Parents: 3bb7a6d
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Tue Jun 2 16:03:25 2015 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Tue Jun 2 16:03:25 2015 +0300
----------------------------------------------------------------------
.../STORM/0.9.1.2.1/package/scripts/params_linux.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1bb0a8da/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py
index fa31f04..6c3078b 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py
@@ -102,8 +102,10 @@ if len(nimbus_hosts) > 1:
actual_topology_min_replication_count = 2
else:
actual_topology_max_replication_wait_time_sec = default_topology_max_replication_wait_time_sec
- actual_topology_min_replication_count = default_topology_min_replication_count
-
+ actual_topology_min_replication_count = default_topology_min_replication_count
+
+del config['configurations']['storm-site']['topology.max.replication.wait.time.sec.default']
+del config['configurations']['storm-site']['topology.min.replication.count.default']
rest_api_port = "8745"
rest_api_admin_port = "8746"
rest_api_conf_file = format("{conf_dir}/config.yaml")