-
Notifications
You must be signed in to change notification settings - Fork 73
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 #21119: When a technique is not in the active techique tree, it can't be deleted in editor #4292
Conversation
Fixes #20281: Query seems to be ignored for pendings nodes
…o branches/rudder/6.2
…o branches/rudder/6.2
…o branches/rudder/6.2
…o branches/rudder/6.2
…o branches/rudder/6.2
c2809cc
to
9d12411
Compare
9d12411
to
2bb7648
Compare
@@ -138,40 +134,56 @@ class TechniqueWriter ( | |||
cr1.copy(directives = cr1.directives ++ cr2.directives) | |||
} | |||
|
|||
for { | |||
directives <- readDirectives.getFullDirectiveLibrary().map(_.allActiveTechniques.values.filter(_.techniqueName.value == techniqueId.name.value).flatMap(_.directives).filter(_.techniqueVersion == techniqueId.version)) | |||
technique <- techniqueRepository.get(techniqueId).notOptional(s"No Technique with ID '${techniqueId.toString()}' found in reference library.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should extract the for loop in a function (maybe an inner function, it does not need to be global for now)
Same for the none part, it should be in an inner function
for { | ||
_ <- ZIO.foreach(unknownTechniquesDir) { f => | ||
val cat = f.pathAsString.substring(s"${basePath}/techniques/".length).split("/").filter(s => s != techniqueName && s != techniqueVersion).toList | ||
archiver.deleteTechnique(techniqueName, techniqueVersion, cat, modId, committer, s"Deleting invalid technique ${techniqueName}/${techniqueVersion}").runNow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's forbidden to put runNow
into a ZIO effect. You need to deal with the effects, especially with the error case: if the archiver doesn't succeed, what needs to be done ? (something like delete file by hand ? Or perhaps give a procedure in logs for an admin: delete that, commit in git, reload techniques)
You should split both branch of your code in inner function, it's complicated to understand what both branch is doing. Have you not seen my previous comment ? https://github.com/Normation/rudder/pull/4292/files#r891297849 |
I'm surprised I did refactor in functions, I had pushed the changes but didn't appear.. I will check locally |
} | ||
} | ||
|
||
def removeInvalidTechnique(basePath: String, techniqueName: String): IOResult[Unit] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VinceMacBuche the inner function
Dismissing review, changes were made
This PR is not mergeable to upper versions. |
…o branches/rudder/6.2
OK, squash merging this PR |
… can't be deleted in editor
55b310b
to
c773656
Compare
https://issues.rudder.io/issues/21119