Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #18952: Static group which depends on dynamic subgroup must be forbiden #5286

Conversation

fanf
Copy link
Member

@fanf fanf commented Dec 21, 2023

https://issues.rudder.io/issues/18952

Manage the cases where subgroup changes cause chaos on other subgroup, either by being deleted, or becoming static (with dyn dep) or decoming dynamic (used in subgroup of static group).

There is a lot of lines changed, but most are error handling.

The logic is similar for both "look if the node becoming dynamic is a dependency of a static group" or "look if the group becoming static as a dynamic group as a subgroup": each time, unwind the the query of the interesting group, look for the nature of dependencies.

The error is not returned in the IOResult error channel, since it's user-actionnable: it's an option (in that case, the Some contains a string for the list of bad groups).

The configirmation pop-up on deletion is handle by cssSel magic, I was happy to not have to change its HTML at all.

  • the warning for deletion when used on other group:

image

  • the error when a dyn group depending on dyn group becomes static:

image

  • the error when a static group dependency becomes dynamic:

image

val html: NodeSeq = dependingSubgroups match {
case None => popup.popupContent()
case Some(msg) =>
val cssSel: CssSel = "#explanationMessageZone *+" #>
Copy link
Member Author

Choose a reason for hiding this comment

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

that cssSel means: "add after the last child in content"

Copy link
Contributor

Choose a reason for hiding this comment

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

woaaah it's quite inventive

@fanf
Copy link
Member Author

fanf commented Dec 22, 2023

PR updated with a new commit

@fanf fanf requested review from clarktsiory and removed request for VinceMacBuche January 4, 2024 09:58
Copy link
Contributor

@clarktsiory clarktsiory left a comment

Choose a reason for hiding this comment

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

Overall this works fine, except for one little edge case :

  • I set a static parent group to have a sub-group A which is static, it works fine
  • Then I change the sub-groups of the parent to another sub-group B which is also static
  • Then I change the sub-group A to be dynamic (which is fine, it has no parent)
  • Finally I change the parent group to have A as sub-group... And it's still saving without any error ! But there should be, because the parent is static and A is now dynamic, it breaks the rule !

Maybe there is some state left in memory here, but it seems hard to debug. Ideally we should later move that whole logic to another part (NodeFactRepo) so it's fine for now !

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/5286
-- Your faithful QA
Kant merge: "Live your life as though your every act were to become a universal law."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/78293/console)

@fanf
Copy link
Member Author

fanf commented Jan 4, 2024

OK, squash merging this PR

@fanf fanf force-pushed the bug_18952/static_group_which_depends_on_dynamic_subgroup_must_be_forbiden branch from 0f729f8 to 5f84c91 Compare January 4, 2024 21:12
@fanf fanf merged commit 5f84c91 into Normation:branches/rudder/7.3 Jan 4, 2024
2 of 15 checks passed
@fanf fanf deleted the bug_18952/static_group_which_depends_on_dynamic_subgroup_must_be_forbiden branch March 15, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants