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 #17872: unsaved change technique popup when not necessary #3108

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ class TechniqueWriter (
}
}

def writeTechniqueAndUpdateLib(technique : Technique, methods: Map[BundleName, GenericMethod], modId : ModificationId, committer : EventActor) : IOResult[Seq[String]] = {
def writeTechniqueAndUpdateLib(technique : Technique, methods: Map[BundleName, GenericMethod], modId : ModificationId, committer : EventActor) : IOResult[Technique] = {
for {
agentFiles <- writeTechnique(technique,methods,modId,committer)
updatedTechnique <- writeTechnique(technique,methods,modId,committer)
libUpdate <- techLibUpdate.update(modId, committer, Some(s"Update Technique library after creating files for ncf Technique ${technique.name}")).
toIO.chainError(s"An error occured during technique update after files were created for ncf Technique ${technique.name}")
_ <- ZIO.when(doRudderLangTest) {
Expand All @@ -263,7 +263,7 @@ class TechniqueWriter (
s"'rudder.lang.test-loop.exec' in rudder config file: ${err.fullMsg}"))
}
} yield {
agentFiles
updatedTechnique
}
}

Expand All @@ -279,7 +279,7 @@ class TechniqueWriter (
}

// Write and commit all techniques files
def writeTechnique(technique : Technique, methods: Map[BundleName, GenericMethod], modId : ModificationId, committer : EventActor) : IOResult[Seq[String]] = {
def writeTechnique(technique : Technique, methods: Map[BundleName, GenericMethod], modId : ModificationId, committer : EventActor) : IOResult[Technique] = {
for {
agentFiles <- writeAgentFiles(technique, methods, modId, committer)
metadata <- writeMetadata(technique, methods, modId, committer)
Expand All @@ -290,7 +290,7 @@ class TechniqueWriter (
// Commit technique with old resources, will effectively delete and add resources
commit <- archiver.commitTechnique(technique,json +: metadata +: agentFiles, modId, committer, s"Committing technique ${technique.name}")
} yield {
metadata +: agentFiles
techniqueWithResourceUpdated
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ class NcfApi(
methods <- restExtractor.extractGenericMethod(json \ "methods")
methodMap = methods.map(m => (m.id,m)).toMap
technique <- restExtractor.extractNcfTechnique(json \ "technique", methodMap, false)
allDone <- techniqueWriter.writeTechniqueAndUpdateLib(technique, methodMap, modId, authzToken.actor ).toBox
updatedTechnique <- techniqueWriter.writeTechniqueAndUpdateLib(technique, methodMap, modId, authzToken.actor ).toBox
} yield {
json
JObject(JField("technique", techniqueSerializer.serializeTechniqueMetadata(updatedTechnique)))
}
val wrapper : ActionType = {
case _ => response
Expand Down Expand Up @@ -389,9 +389,9 @@ class NcfApi(
internalId <- OptionnalJson.extractJsonString(json \ "technique", "internalId")
// If no internalId (used to manage temporary folder for resources), ignore resources, this can happen when importing techniques through the api
resoucesMoved <- internalId.map( internalId => moveRessources(technique,internalId).toBox).getOrElse(Full("Ok"))
allDone <- techniqueWriter.writeTechniqueAndUpdateLib(technique, methodMap, modId, authzToken.actor).toBox
updatedTech <- techniqueWriter.writeTechniqueAndUpdateLib(technique, methodMap, modId, authzToken.actor).toBox
} yield {
json
JObject(JField("technique", techniqueSerializer.serializeTechniqueMetadata(updatedTech)))
}

val wrapper : ActionType = {
Expand Down