Add group consistency check to domain template deletion#3275
Conversation
Signed-off-by: t4niwa <taniwa@lycorp.co.jp>
There was a problem hiding this comment.
Code Review
This pull request introduces a consistency check in the deleteDomainTemplate method to ensure that template groups are not referenced by roles in other domains before a template is deleted. The review feedback suggests adding a null check for group objects within the template iteration to handle potential misconfigurations in the solution_templates.json file, which improves robustness and aligns with configuration logging standards.
| for (Group group : template.getGroups()) { | ||
| String groupName = group.getName().replace("_domain_", domainName); | ||
| groupMemberConsistencyCheck(domainName, groupName, true, caller); | ||
| } |
There was a problem hiding this comment.
To improve robustness and adhere to the repository's configuration handling rules, add a null check for the group object. Since solution_templates.json is a configuration file, any null or invalid entries should be logged as an ERROR to signal a clear misconfiguration.
for (Group group : template.getGroups()) {
if (group == null) {
LOG.error("Invalid configuration: null group entry found in solution_templates.json");
continue;
}
String groupName = group.getName().replace("_domain_", domainName);
groupMemberConsistencyCheck(domainName, groupName, true, caller);
}References
- If a configuration property is defined but results in an empty or invalid value, it should be logged as an ERROR to signal a clear misconfiguration.
|
@t4niwa please add tests cases for the new code. any new line in any of the servers or shared libraries must be fully covered with an appropriate test case |
Signed-off-by: t4niwa <taniwa@lycorp.co.jp>
Signed-off-by: t4niwa <taniwa@lycorp.co.jp>
Description
Add group consistency check to domain template deletion. #3273
Contribution Checklist:
Attach Screenshots (Optional)