MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / get_net_work

Method get_net_work

mod/project/node/nodeutil/ssh_wrap.py:56–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

54 return self._ssh_executor
55
56 def get_net_work(self) -> Tuple[Optional[dict], str]:
57 data, err = self._run_script("system_info.sh")
58 if err:
59 return None, err
60 if not data.exit_code == 0:
61 return None, data.stderr
62 try:
63 data = json.loads(data.stdout)
64 if isinstance(data, dict) and "cpu" in data and "mem" in data:
65 return self._tans_net_work_form_data(data), ""
66 return None, "数据格式错误: %s" % str(data)
67 except Exception as e:
68 return None, str(e)
69
70 @staticmethod
71 def _tans_net_work_form_data(data: dict):

Callers 2

monitor_node_onceFunction · 0.95

Calls 3

_run_scriptMethod · 0.95
loadsMethod · 0.45

Tested by

no test coverage detected