|
@@ -17,20 +17,12 @@
|
|
|
*/
|
|
|
package org.apache.ambari.server.state;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.LinkedHashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Map.Entry;
|
|
|
-import java.util.Set;
|
|
|
-import java.util.TreeMap;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
-
|
|
|
+import com.google.common.cache.Cache;
|
|
|
+import com.google.common.cache.CacheBuilder;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
+import com.google.inject.Inject;
|
|
|
+import com.google.inject.Singleton;
|
|
|
+import com.google.inject.persist.Transactional;
|
|
|
import org.apache.ambari.server.AmbariException;
|
|
|
import org.apache.ambari.server.api.services.AmbariMetaInfo;
|
|
|
import org.apache.ambari.server.configuration.Configuration;
|
|
@@ -44,12 +36,19 @@ import org.apache.ambari.server.upgrade.UpgradeCatalog170;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
-import com.google.common.cache.Cache;
|
|
|
-import com.google.common.cache.CacheBuilder;
|
|
|
-import com.google.common.collect.Maps;
|
|
|
-import com.google.inject.Inject;
|
|
|
-import com.google.inject.Singleton;
|
|
|
-import com.google.inject.persist.Transactional;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Map.Entry;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.TreeMap;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* Helper class that works with config traversals.
|
|
@@ -463,18 +462,24 @@ public class ConfigHelper {
|
|
|
}
|
|
|
|
|
|
public Set<String> getPropertyValuesWithPropertyType(StackId stackId, PropertyType propertyType, Cluster cluster) throws AmbariException {
|
|
|
- StackInfo stack = ambariMetaInfo.getStack(stackId.getStackName(),
|
|
|
- stackId.getStackVersion());
|
|
|
-
|
|
|
+ StackInfo stack = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion());
|
|
|
+ Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
|
|
|
+ Map<String, Config> actualConfigs = new HashMap<>();
|
|
|
Set<String> result = new HashSet<String>();
|
|
|
|
|
|
+ for (Map.Entry<String, DesiredConfig> desiredConfigEntry : desiredConfigs.entrySet()) {
|
|
|
+ String configType = desiredConfigEntry.getKey();
|
|
|
+ DesiredConfig desiredConfig = desiredConfigEntry.getValue();
|
|
|
+ actualConfigs.put(configType, cluster.getConfig(configType, desiredConfig.getTag()));
|
|
|
+ }
|
|
|
+
|
|
|
for (Service service : cluster.getServices().values()) {
|
|
|
Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), service.getName());
|
|
|
for (PropertyInfo serviceProperty : serviceProperties) {
|
|
|
if (serviceProperty.getPropertyTypes().contains(propertyType)) {
|
|
|
String stackPropertyConfigType = fileNameToConfigType(serviceProperty.getFilename());
|
|
|
try {
|
|
|
- result.add(cluster.getDesiredConfigByType(stackPropertyConfigType).getProperties().get(serviceProperty.getName()));
|
|
|
+ result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(serviceProperty.getName()));
|
|
|
} catch (Exception ex) {
|
|
|
}
|
|
|
}
|
|
@@ -486,7 +491,7 @@ public class ConfigHelper {
|
|
|
for (PropertyInfo stackProperty : stackProperties) {
|
|
|
if (stackProperty.getPropertyTypes().contains(propertyType)) {
|
|
|
String stackPropertyConfigType = fileNameToConfigType(stackProperty.getFilename());
|
|
|
- result.add(cluster.getDesiredConfigByType(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
|
|
|
+ result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
|
|
|
}
|
|
|
}
|
|
|
|