class documentation

class RpcResult(object):

View In Hierarchy

RPC Result class.

This class holds an RPC result. It is needed since in multi-node calls we can't raise an exception just because one out of many failed, and therefore we use this class to encapsulate the result.

Method __init__ Undocumented
Method __repr__ Undocumented
Method Raise If the result has failed, raise an OpExecError.
Method Warn If the result has failed, call the feedback_fn.
Instance Variable call the name of the RPC call
Instance Variable data the data payload, for successful results, or None
Instance Variable fail_msg the error message if the call failed
Instance Variable node the name of the node to which we made the call
Instance Variable offline whether the operation failed because the node was offline, as opposed to actual failure; offline=True will always imply failed=True, in order to allow simpler checking if the user doesn't care about the exact failure mode...
Instance Variable payload Undocumented
Static Method _EnsureErr Helper to ensure we return a 'True' value for error.
def __init__(self, data=None, failed=False, offline=False, call=None, node=None):

Undocumented

def __repr__(self):

Undocumented

def Raise(self, msg, prereq=False, ecode=None):

If the result has failed, raise an OpExecError.

This is used so that LU code doesn't have to check for each result, but instead can call this function.

def Warn(self, msg, feedback_fn):

If the result has failed, call the feedback_fn.

This is used to in cases were LU wants to warn the user about a failure, but continue anyway.

call =

the name of the RPC call

data =

the data payload, for successful results, or None

fail_msg: str =

the error message if the call failed

node =

the name of the node to which we made the call

offline =

whether the operation failed because the node was offline, as opposed to actual failure; offline=True will always imply failed=True, in order to allow simpler checking if the user doesn't care about the exact failure mode

payload =

Undocumented

@staticmethod
def _EnsureErr(val):

Helper to ensure we return a 'True' value for error.