|
@@ -819,6 +819,25 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
|
|
|
|
|
|
Map<String, String> requestProperties = request.getProperties();
|
|
|
|
|
|
+ // Configuration attributes are optional. If not present, use default(provided by stack), otherwise merge default
|
|
|
+ // with request-provided
|
|
|
+ Map<String, Map<String, String>> requestPropertiesAttributes = request.getPropertiesAttributes();
|
|
|
+
|
|
|
+ if (requestPropertiesAttributes != null && requestPropertiesAttributes.containsKey(PASSWORD)) {
|
|
|
+ for (Map.Entry<String, String> requestEntry : requestPropertiesAttributes.get(PASSWORD).entrySet()) {
|
|
|
+ String passwordProperty = requestEntry.getKey();
|
|
|
+ if(requestProperties.containsKey(passwordProperty) && requestEntry.getValue().equals("true")) {
|
|
|
+ String passwordPropertyValue = requestProperties.get(passwordProperty);
|
|
|
+ if (!SecretReference.isSecret(passwordPropertyValue)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ SecretReference ref = new SecretReference(passwordPropertyValue, cluster);
|
|
|
+ String refValue = ref.getValue();
|
|
|
+ requestProperties.put(passwordProperty, refValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Map<PropertyInfo.PropertyType, Set<String>> propertiesTypes = cluster.getConfigPropertiesTypes(request.getType());
|
|
|
if(propertiesTypes.containsKey(PropertyType.PASSWORD)) {
|
|
|
for(String passwordProperty : propertiesTypes.get(PropertyType.PASSWORD)) {
|
|
@@ -842,10 +861,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
|
|
|
configs = new HashMap<String, Config>();
|
|
|
}
|
|
|
|
|
|
- // Configuration attributes are optional. If not present, use default(provided by stack), otherwise merge default
|
|
|
- // with request-provided
|
|
|
- Map<String, Map<String, String>> requestPropertiesAttributes = request.getPropertiesAttributes();
|
|
|
-
|
|
|
Map<String, Map<String, String>> propertiesAttributes = new HashMap<String, Map<String,String>>();
|
|
|
|
|
|
StackId currentStackId = cluster.getCurrentStackVersion();
|
|
@@ -1540,6 +1555,7 @@ 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();
|
|
|
|
|
|
// processing password properties
|
|
|
if(requestConfigProperties != null && !requestConfigProperties.isEmpty()) {
|
|
@@ -1549,8 +1565,11 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
|
|
|
for (Entry<String, String> property : requestConfigProperties.entrySet()) {
|
|
|
String propertyName = property.getKey();
|
|
|
String propertyValue = property.getValue();
|
|
|
- if (propertiesTypes.containsKey(PropertyType.PASSWORD) &&
|
|
|
- propertiesTypes.get(PropertyType.PASSWORD).contains(propertyName)) {
|
|
|
+ if ((propertiesTypes.containsKey(PropertyType.PASSWORD) &&
|
|
|
+ propertiesTypes.get(PropertyType.PASSWORD).contains(propertyName)) ||
|
|
|
+ (requestConfigAttributes != null && requestConfigAttributes.containsKey(PASSWORD) &&
|
|
|
+ requestConfigAttributes.get(PASSWORD).containsKey(propertyName) &&
|
|
|
+ requestConfigAttributes.get(PASSWORD).get(propertyName).equals("true"))) {
|
|
|
if (SecretReference.isSecret(propertyValue)) {
|
|
|
SecretReference ref = new SecretReference(propertyValue, cluster);
|
|
|
requestConfigProperties.put(propertyName, ref.getValue());
|
|
@@ -1558,7 +1577,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- 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;
|