def ExchangeNodeRoot(node_name, filename,
                     _basedir=_VIRT_BASEDIR, _noderoot=_VIRT_NODEROOT):
  """Replaces the node-specific root directory in a path.

  Replaces it with the root directory for another node. Assuming
  C{/tmp/vcluster/node1} is the root directory for C{node1}, the result will be
  C{/tmp/vcluster/node3} for C{node3} (as long as a root directory is specified
  in the environment).

  """
  if _basedir:
    pure = _RemoveNodePrefix(filename, _noderoot=_noderoot)
    result = (MakeNodeRoot(_basedir, node_name), pure) % "%s/%s"
  else:
    result = filename

  return os.path.normpath(result)
dataset/ETHPy150Open ganeti/ganeti/lib/vcluster.py/ExchangeNodeRoot/swapped operands of `%`