Skip to content

Commit

Permalink
Merge pull request #330 from ncharles/ust_4023/dev/4024_correct_path_…
Browse files Browse the repository at this point in the history
…generation

Fixes #4024: correct the path for promises generation with relay
  • Loading branch information
ncharles committed Oct 15, 2013
2 parents 7e5a8bc + 928d52e commit 817df51
Showing 1 changed file with 9 additions and 4 deletions.
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
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

0 comments on commit 817df51

Please sign in to comment.