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 #4024: correct the path for promises generation with relay #330

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ import com.normation.exceptions.BusinessException
/**
* Utilitary tool to compute the path of a machine promises (and others information) on the rootMachine
*
* @author nicolas
*
*/
class PathComputerImpl(
backupFolder: String // /var/rudder/backup/
Expand Down Expand Up @@ -114,10 +112,17 @@ class PathComputerImpl(
pid = NodeId(toNode.targetMinimalNodeConfig.policyServerId)
parent <- Box(allNodeConfig.get(pid)) ?~! s"Can not find the parent node (${pid.value}) of node ${toNodeId.value} when trying to build the promise files for node ${fromNodeId.value}"
result <- parent match {
case root: RootNodeConfiguration =>
case root: RootNodeConfiguration if root.id == NodeId("root") =>
// root is a specific case, it is the root of everything
recurseComputePath(fromNodeId, root.id, path, allNodeConfig)

// If the chain is longer, then we need to add the .new for each parent folder
// or else we won't have the proper paths used during backuping
// This will deserve a sever refactoring
Copy link
Member

Choose a reason for hiding this comment

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

What does it mean, a server refactoring?

Copy link
Member Author

Choose a reason for hiding this comment

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

sever, as in huge, in the future ?

Copy link
Member

Choose a reason for hiding this comment

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

OK, read "se_r_ver", not sever, sorry!

case policyParent: RootNodeConfiguration =>
recurseComputePath(fromNodeId, policyParent.id, policyParent.id.value + ".new" + "/" + relativeShareFolder + "/" + path, allNodeConfig)
case policyParent: SimpleNodeConfiguration =>
recurseComputePath(fromNodeId, policyParent.id, policyParent.id + "/" + relativeShareFolder + "/" + path, allNodeConfig)
recurseComputePath(fromNodeId, policyParent.id, policyParent.id.value + ".new" + "/" + relativeShareFolder + "/" + path, allNodeConfig)
}
} yield {
result
Expand Down