Esempio n. 1
0
def node_communication_not_connected(node, reason):
    """
    an error occured when connecting to a remote node, debug info
    node string node address / name
    reason string decription of the error
    """
    return ReportItem.debug(report_codes.NODE_COMMUNICATION_NOT_CONNECTED,
                            info={
                                "node": node,
                                "reason": reason,
                            })
Esempio n. 2
0
def node_communication_started(target, data):
    """
    request is about to be sent to a remote node, debug info
    target string where the request is about to be sent to
    data string request's data
    """
    return ReportItem.debug(report_codes.NODE_COMMUNICATION_STARTED,
                            info={
                                "target": target,
                                "data": data,
                            })
Esempio n. 3
0
def run_external_process_started(command, stdin):
    """
    information about running an external process
    command string the external process command
    stdin string passed to the external process via its stdin
    """
    return ReportItem.debug(report_codes.RUN_EXTERNAL_PROCESS_STARTED,
                            info={
                                "command": command,
                                "stdin": stdin,
                            })
Esempio n. 4
0
def node_communication_not_connected(node, reason):
    """
    an error occured when connecting to a remote node, debug info
    node string node address / name
    reason string decription of the error
    """
    return ReportItem.debug(
        report_codes.NODE_COMMUNICATION_NOT_CONNECTED,
        info={
            "node": node,
            "reason": reason,
        }
    )
Esempio n. 5
0
def node_communication_started(target, data):
    """
    request is about to be sent to a remote node, debug info
    target string where the request is about to be sent to
    data string request's data
    """
    return ReportItem.debug(
        report_codes.NODE_COMMUNICATION_STARTED,
        info={
            "target": target,
            "data": data,
        }
    )
Esempio n. 6
0
def node_communication_finished(target, retval, data):
    """
    remote node request has been finished, debug info
    target string where the request was sent to
    retval response return code
    data response data
    """
    return ReportItem.debug(report_codes.NODE_COMMUNICATION_FINISHED,
                            info={
                                "target": target,
                                "response_code": retval,
                                "response_data": data
                            })
Esempio n. 7
0
def run_external_process_started(command, stdin, environment):
    """
    information about running an external process
    command string the external process command
    stdin string passed to the external process via its stdin
    """
    return ReportItem.debug(
        report_codes.RUN_EXTERNAL_PROCESS_STARTED,
        info={
            "command": command,
            "stdin": stdin,
            "environment": environment,
        }
    )
Esempio n. 8
0
def node_communication_finished(target, retval, data):
    """
    remote node request has been finished, debug info
    target string where the request was sent to
    retval response return code
    data response data
    """
    return ReportItem.debug(
        report_codes.NODE_COMMUNICATION_FINISHED,
        info={
            "target": target,
            "response_code": retval,
            "response_data": data
        }
    )
Esempio n. 9
0
def run_external_process_finished(command, retval, stdout, stderr):
    """
    information about result of running an external process
    command string the external process command
    retval external process's return (exit) code
    stdout string external process's stdout
    stderr string external process's stderr
    """
    return ReportItem.debug(report_codes.RUN_EXTERNAL_PROCESS_FINISHED,
                            info={
                                "command": command,
                                "return_value": retval,
                                "stdout": stdout,
                                "stderr": stderr,
                            })
Esempio n. 10
0
def run_external_process_finished(command, retval, stdout, stderr):
    """
    information about result of running an external process
    command string the external process command
    retval external process's return (exit) code
    stdout string external process's stdout
    stderr string external process's stderr
    """
    return ReportItem.debug(
        report_codes.RUN_EXTERNAL_PROCESS_FINISHED,
        info={
            "command": command,
            "return_value": retval,
            "stdout": stdout,
            "stderr": stderr,
        }
    )
Esempio n. 11
0
def run_external_process_finished(command, retval, stdout):
    """
    information about result of running an external process
    command string the external process command
    retval external process's return (exit) code
    stdout string external process's stdout
    """
    return ReportItem.debug(
        report_codes.RUN_EXTERNAL_PROCESS_FINISHED,
        "Finished running: {command}\nReturn value: {return_value}"
        + "\n--Debug Output Start--\n{stdout}\n--Debug Output End--\n",
        info={
            "command": command,
            "return_value": retval,
            "stdout": stdout,
        }
    )
Esempio n. 12
0
def node_communication_finished(target, retval, data):
    """
    remote node request has been finished, debug info
    target string where the request was sent to
    retval response return code
    data response data
    """
    return ReportItem.debug(
        report_codes.NODE_COMMUNICATION_FINISHED,
        "Finished calling: {target}\nResponse Code: {response_code}"
        + "\n--Debug Response Start--\n{response_data}\n--Debug Response End--"
        + "\n",
        info={
            "target": target,
            "response_code": retval,
            "response_data": data
        }
    )
Esempio n. 13
0
def node_communication_started(target, data):
    """
    request is about to be sent to a remote node, debug info
    target string where the request is about to be sent to
    data string request's data
    """
    msg = "Sending HTTP Request to: {target}"
    if data:
        msg += "\n--Debug Input Start--\n{data}\n--Debug Input End--"
    msg += "\n"
    return ReportItem.debug(
        report_codes.NODE_COMMUNICATION_STARTED,
        msg,
        info={
            "target": target,
            "data": data,
        }
    )
Esempio n. 14
0
def run_external_process_started(command, stdin):
    """
    information about running an external process
    command string the external process command
    stdin string passed to the external process via its stdin
    """
    msg = "Running: {command}"
    if stdin:
        msg += "\n--Debug Input Start--\n{stdin}\n--Debug Input End--"
    msg += "\n"
    return ReportItem.debug(
        report_codes.RUN_EXTERNAL_PROCESS_STARTED,
        msg,
        info={
            "command": command,
            "stdin": stdin,
        }
    )