Skip to content

Add group consistency check to domain template deletion#3275

Merged
havetisyan merged 3 commits intoAthenZ:masterfrom
t4niwa:fix/zms-template-deletion-group-consistency-check
Apr 6, 2026
Merged

Add group consistency check to domain template deletion#3275
havetisyan merged 3 commits intoAthenZ:masterfrom
t4niwa:fix/zms-template-deletion-group-consistency-check

Conversation

@t4niwa
Copy link
Copy Markdown
Contributor

@t4niwa t4niwa commented Apr 3, 2026

Description

Add group consistency check to domain template deletion. #3273

Contribution Checklist:

  • The pull request does not introduce any breaking changes
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Attach Screenshots (Optional)

Signed-off-by: t4niwa <taniwa@lycorp.co.jp>
@t4niwa t4niwa changed the title add group consistency check to template deletion Add group consistency check to domain template deletion Apr 3, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +3258 to +3261
for (Group group : template.getGroups()) {
String groupName = group.getName().replace("_domain_", domainName);
groupMemberConsistencyCheck(domainName, groupName, true, caller);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. 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.

@havetisyan
Copy link
Copy Markdown
Collaborator

@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

t4niwa added 2 commits April 6, 2026 09:46
Signed-off-by: t4niwa <taniwa@lycorp.co.jp>
Signed-off-by: t4niwa <taniwa@lycorp.co.jp>
@havetisyan havetisyan merged commit 7590f20 into AthenZ:master Apr 6, 2026
3 checks passed
@t4niwa t4niwa deleted the fix/zms-template-deletion-group-consistency-check branch April 6, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants