Skip to content

Commit f1cade9

Browse files
committed
fix: invalid warnings when running the Dekorate session
There are some system properties that are not directly mapped using generators like `dekorate.build` or `dekorate.push`. These properties will either enable some special handling, functionality and/or include some other properties. The problem is that at the moment, the session is checking whether these properties are properly mapped and if not, it will trace a warning. Therefore, as these properties are programmatically used and there are many more like `dekorate.input.dir`, `dekorate.output.dir`, `dekorate.image-pull-secrets`, `dekorate.properties.profile`, `dekorate.verbose`, `dekorate.test.xxx`, ... and maybe more coming in the future, I think the best way is to not trace this warning ever. The alternative is to maintain a list with all the above values, however I don't really like this approach as this list will be likely became out-date when adding a new unmapped property. Fix dekorateio#995
1 parent 8c9694f commit f1cade9

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

core/src/main/java/io/dekorate/Session.java

+11-17
Original file line numberDiff line numberDiff line change
@@ -162,23 +162,17 @@ public void addPropertyConfiguration(Map<String, Object> map) {
162162
}
163163

164164
public void addConfiguration(Map<String, Object> map, BiConsumer<ConfigurationGenerator, Map<String, Object>> consumer) {
165-
for (Map.Entry<String, Object> entry : map.entrySet()) {
166-
String key = entry.getKey();
167-
Object value = entry.getValue();
168-
ConfigurationGenerator generator = configurationGenerators.get(key);
169-
if (generator != null) {
170-
if (value instanceof Map) {
171-
Map<String, Object> generatorMap = new HashMap<>();
172-
Class configClass = configtypes.get(key);
173-
String newKey = configClass.getName();
174-
Generators.applyPrimitives(configClass, (Map<String, Object>) value);
175-
Generators.populateArrays(configClass, (Map<String, Object>) value);
176-
generatorMap.put(newKey, value);
177-
consumer.accept(generator, Maps.kebabToCamelCase(generatorMap));
178-
}
179-
} else {
180-
LOGGER.warning("Unknown generator '" + key + "' will be ignored. "
181-
+ "Known generators are: " + configurationGenerators.keySet());
165+
for (ConfigurationGenerator generator : configurationGenerators.values()) {
166+
String key = generator.getKey();
167+
Object value = map.get(key);
168+
if (value instanceof Map) {
169+
Map<String, Object> generatorMap = new HashMap<>();
170+
Class configClass = configtypes.get(key);
171+
String newKey = configClass.getName();
172+
Generators.applyPrimitives(configClass, (Map<String, Object>) value);
173+
Generators.populateArrays(configClass, (Map<String, Object>) value);
174+
generatorMap.put(newKey, value);
175+
consumer.accept(generator, Maps.kebabToCamelCase(generatorMap));
182176
}
183177
}
184178
}

0 commit comments

Comments
 (0)