Network check for MCC/MOS
- Network info gathering using DaemonSet with 'hostNetwork=True'
- DaemonSet handling routines
- Mapper and Checker refactoring for Kube
Fixes
- SSH timeouts handling using env vars
MCP_SSH_TIMEOUT when connecting
MCP_SCRIPT_RUN_TIMEOUT when running command
- Progress class supports 0 as an index
Related-PROD: PROD-36575
Change-Id: Ie03a9051007eeb788901acae3696ea2bfdfe33e2
diff --git a/cfg_checker/reports/reporter.py b/cfg_checker/reports/reporter.py
index d103cb4..7ddbc4f 100644
--- a/cfg_checker/reports/reporter.py
+++ b/cfg_checker/reports/reporter.py
@@ -118,9 +118,9 @@
@six.add_metaclass(abc.ABCMeta)
class _Base(object):
- def __init__(self, salt_master=None):
+ def __init__(self, master=None):
self.jinja2_env = self.init_jinja2_env()
- self.salt_master = salt_master
+ self.master = master
@abc.abstractmethod
def __call__(self, payload):
@@ -230,7 +230,7 @@
def _dmidecode(_dict, type=0):
# _key = "dmi"
_key_r = "dmi_r"
- _f_cmd = self.salt_master.get_cmd_for_nodes
+ _f_cmd = self.master.get_cmd_for_nodes
_cmd = "dmidecode -t {}".format(type)
_f_cmd(_cmd, _key_r, target_dict=_dict)
# TODO: parse BIOS output or given type
@@ -239,7 +239,7 @@
def _lsblk(_dict):
# _key = "lsblk"
_key_r = "lsblk_raw"
- _f_cmd = self.salt_master.get_cmd_for_nodes
+ _f_cmd = self.master.get_cmd_for_nodes
_columns = [
"NAME",
"HCTL",
@@ -260,7 +260,7 @@
_key = "lscpu"
_key_r = "lscpu_raw"
# get all of the values
- _f_cmd = self.salt_master.get_cmd_for_nodes
+ _f_cmd = self.master.get_cmd_for_nodes
_cmd = "lscpu | sed -n '/\\:/s/ \\+/ /gp'"
_f_cmd(_cmd, _key_r, target_dict=_dict)
# parse them and put into dict
@@ -290,7 +290,7 @@
def _free(_dict):
_key = "ram"
_key_r = "ram_raw"
- _f_cmd = self.salt_master.get_cmd_for_nodes
+ _f_cmd = self.master.get_cmd_for_nodes
_cmd = "free -h | sed -n '/Mem/s/ \\+/ /gp'"
_f_cmd(_cmd, _key_r, target_dict=_dict)
# parse them and put into dict
@@ -323,7 +323,7 @@
def _services(_dict):
_key = "services"
_key_r = "services_raw"
- _f_cmd = self.salt_master.get_cmd_for_nodes
+ _f_cmd = self.master.get_cmd_for_nodes
_cmd = "service --status-all"
_f_cmd(_cmd, _key_r, target_dict=_dict)
for node, dt in _dict.items():
@@ -350,7 +350,7 @@
def _vcp_status(_dict):
_key = "virsh"
_key_r = "virsh_raw"
- self.salt_master.get_cmd_for_nodes(
+ self.master.get_cmd_for_nodes(
"virsh list --all | sed -n -e '/[0-9]/s/ \\+/ /gp'",
_key_r,
target_dict=_dict,
@@ -383,7 +383,7 @@
def _soft_net_stats(_dict):
_key = "net_stats"
_key_r = "net_stats_raw"
- _f_cmd = self.salt_master.get_cmd_for_nodes
+ _f_cmd = self.master.get_cmd_for_nodes
_cmd = "cat /proc/net/softnet_stat; echo \\#; " \
"sleep {}; cat /proc/net/softnet_stat".format(
_softnet_interval
@@ -465,7 +465,7 @@
}
# get kernel version
- self.salt_master.get_cmd_for_nodes(
+ self.master.get_cmd_for_nodes(
"uname -r",
"kernel",
target_dict=data["nodes"]
@@ -481,7 +481,7 @@
# sample: /dev/vda1 78G 33G 45G 43%
_key = "disk"
_key_r = "disk_raw"
- self.salt_master.get_cmd_for_nodes(
+ self.master.get_cmd_for_nodes(
"df -h | sed -n '/^\\/dev/s/ \\+/ /gp' | cut -d\" \" -f 1-5",
"disk_raw",
target_dict=data["nodes"]
@@ -526,12 +526,12 @@
for net, net_v in data['map'].items():
for node, ifs in net_v.items():
for d in ifs:
- _err = "fail"
- d['interface_error'] = _err if d['interface_error'] else ""
- d['mtu_error'] = _err if d['mtu_error'] else ""
- d['status_error'] = _err if d['status_error'] else ""
+ _e = "fail"
+ d['interface_error'] = _e if 'interface_error' in d else ""
+ d['mtu_error'] = _e if 'mtu_error' in d else ""
+ d['status_error'] = _e if 'status_error' in d else ""
d['subnet_gateway_error'] = \
- _err if d['subnet_gateway_error'] else ""
+ _e if 'subnet_gateway_error' in d else ""
_services(data["nodes"])
# vcp status