Beispiel #1
0
def get_cpu_info() -> LscpuCommandResult:
    """
    Execute lscpu command via subprocess. Blocks while waiting for output.
    """
    return list(subprocess_workflow.exec_and_parse_subprocesses(
        [LscpuCommandParams()],
        _get_lscpu_command_args_list,
        parse_lscpu_output,
    ))[0]
Beispiel #2
0
def get_routing_table() -> RouteCommandResult:
    """
    Execute route command via subprocess. Blocks while waiting for output.
    Returns the routing table in the form of a list of routes.
    """
    return list(
        subprocess_workflow.exec_and_parse_subprocesses(
            [RouteCommandParams()],
            _get_route_command_args_list,
            parse_route_output,
        ))[0]
Beispiel #3
0
def get_kernel_versions():
    """
    Execute dpkg commands via subprocess. Blocks while waiting for output.

    Returns:
        [DpkgCommandResult]: stats from the executed dpkg commands
    """
    return subprocess_workflow.exec_and_parse_subprocesses(
        [DpkgCommandParams()],
        _get_dpkg_command_args_list,
        parse_dpkg_output,
    )
Beispiel #4
0
def ping(ping_params):
    """
    Execute ping commands via subprocess. Blocks while waiting for output.

    Args:
        ping_params ([PingCommandParams]): params for the pings to execute
    Returns:
        [PingCommandResult]: stats from the executed ping commands
    """
    return subprocess_workflow.exec_and_parse_subprocesses(
        ping_params,
        _get_ping_command_args_list,
        parse_ping_output,
    )
Beispiel #5
0
def traceroute(params):
    """
    Execute some `traceroute` commands via subprocess.

    Args:
        params ([TracerouteParams]): params for the `traceroute` commands

    Returns:
        [TracerouteResult]: stats from the executed `traceroute` commands
    """
    return subprocess_workflow.exec_and_parse_subprocesses(
        params,
        _get_traceroute_command_args_list,
        parse_traceroute_output,
    )