adoroszlai commented on code in PR #4271:
URL: https://github.com/apache/ozone/pull/4271#discussion_r1119937597
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java:
##########
@@ -776,4 +779,22 @@ public static
ContainerProtos.ContainerCommandResponseProto processForDebug(
return msg;
}
+
+ /**
+ * Redacts sensitive configuration.
+ * Sorts all properties by key name
+ *
+ * @param conf OzoneConfiguration object to be printed.
+ * @return Sorted Map of properties
+ */
+ public static Map<String, String> processForLogging(OzoneConfiguration conf)
{
+ Map<String, String> ozoneProps = conf.getOzoneProperties();
+ ConfigRedactor redactor = new ConfigRedactor(conf);
+ Map<String, String> sortedOzoneProps = new TreeMap<>();
+ for (Map.Entry<String, String> entry : ozoneProps.entrySet()) {
+ String value = redactor.redact(entry.getKey(), entry.getValue());
+ sortedOzoneProps.put(entry.getKey(), value);
Review Comment:
This would take care of items with leading/trailing whitespace:
```suggestion
String value = redactor.redact(entry.getKey(), entry.getValue());
if (value != null) {
value = value.trim();
}
sortedOzoneProps.put(entry.getKey(), value);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]