Exemplo n.º 1
0
    def CreateFailedNodeResult(self, node):
        """@see L{RpcResultsBuilder}

    @param node: @see L{RpcResultsBuilder}.
    @rtype: L{rpc.RpcResult}
    """
        return rpc.RpcResult(failed=True, node=self._GetNodeId(node))
Exemplo n.º 2
0
  def _call_nodes_false(node_list, hpath, phase, env):
    """Fake call_hooks_runner function.

    @rtype: dict of node -> L{rpc.RpcResult} with an rpc error
    @return: rpc failure from all nodes

    """
    return dict([(node, rpc.RpcResult("error", failed=True,
                  node=node, call="FakeError")) for node in node_list])
Exemplo n.º 3
0
    def CreateErrorNodeResult(self, node, error_msg=None):
        """@see L{RpcResultsBuilder}

    @param node: @see L{RpcResultsBuilder}.
    @type error_msg: string
    @param error_msg: the error message as returned by the RPC
    @rtype: L{rpc.RpcResult}
    """
        return rpc.RpcResult(data=(False, error_msg),
                             node=self._GetNodeId(node))
Exemplo n.º 4
0
    def CreateSuccessfulNodeResult(self, node, data=None):
        """@see L{RpcResultsBuilder}

    @param node: @see L{RpcResultsBuilder}.
    @type data: dict
    @param data: the data as returned by the RPC
    @rtype: L{rpc.RpcResult}
    """
        if data is None:
            data = {}
        return rpc.RpcResult(data=(True, data), node=self._GetNodeId(node))