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 #11862: RudderUniqueID is not replaced when used in OUTPATH #1835

Merged
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 @@ -488,7 +488,7 @@ class PolicyWriterServiceImpl(
writePromisesFiles(template, preparedTechnique.environmentVariables, paths.newFolder, preparedTechnique.reportIdToReplace)
}
files <- sequence(preparedTechnique.filesToCopy.toSeq) { file =>
copyResourceFile(file, paths.newFolder)
copyResourceFile(file, paths.newFolder, preparedTechnique.reportIdToReplace)
}
} yield {
"OK"
Expand Down Expand Up @@ -638,8 +638,18 @@ class PolicyWriterServiceImpl(
/**
* Copy a resource file from a technique to the node promises directory
*/
private[this] def copyResourceFile(file: TechniqueFile, rulePath: String): Box[String] = {
val destination = new File(rulePath+"/"+file.outPath)
private[this] def copyResourceFile(
file : TechniqueFile
, rulePath : String
, reportIdToReplace: Option[PolicyId]
): Box[String] = {
val destination = {
val out = reportIdToReplace match {
case None => file.outPath
case Some(id) => file.outPath.replaceAll(Policy.TAG_OF_RUDDER_MULTI_POLICY, id.getRudderUniqueId)
}
new File(rulePath+"/"+out)
}

techniqueRepository.getFileContent(file.id) { optStream =>
optStream match {
Expand Down