Skip to content

Commit

Permalink
Fixes #24086: You can create a static group which depends on a dynami…
Browse files Browse the repository at this point in the history
…c one
  • Loading branch information
fanf committed Jan 26, 2024
1 parent 503c673 commit 2aed998
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,20 +468,22 @@ class NodeGroupForm(
)

/*
* - If a group changes from dynamic to static, we must ensure that it does not refer
* - If a group changes from dynamic to static, or is static, we must ensure that it does not refer
* any dynamic subgroup, else raise an error
* See https://issues.rudder.io/issues/18952
*/
if (savedGroup.isDynamic == true && newGroup.isDynamic == false) {
if (newGroup.isDynamic == false) {
hasDynamicSubgroups(newGroup.query).either.runNow match {
case Left(err) =>
formTracker.addFormError(Text("Error when saving group"))
logger.error(
s"Error when getting group information for consistency check on static change status: ${err.fullMsg}"
)
case Right(Some(msg)) =>
val m = s"Error when getting group information for consistency check on static change status: you can't change " +
s"the nature of current group to static because it uses following dynamic groups as a subgroup criteria: ${msg}"
val m = {
s"Error when getting group information for consistency check on static/dynamic status:" +
s"current group can not be static because it uses following dynamic groups as a subgroup criteria: ${msg}"
}
formTracker.addFormError(Text(m))
logger.error(m)
case Right(None) => // ok
Expand Down

0 comments on commit 2aed998

Please sign in to comment.