Multi env support and Kube client integration
Kube friendly Beta
Package versions supports Kube env
Added:
- Env type detection
- New option: --use-env, for selecting env
when function supports multiple detected envs
- Updated config loading
- Each module and command type has supported env check
and stops execution if it is on unsupported env
- Functions can support multiple envs
- Kubernetes dependency
- Kubenernetes API detection: local and remote
- Package checking class hierachy for using Salt or Kube
- Remote pod execution routine
- Flexible SSH/SSH Forwarder classes: with, ssh,do(), etc
- Multithreaded SSH script execution
- Number of workers parameter, default 5
Fixed:
- Config dependency
- Command loading with supported envs list
- Unittests structure and execution flow updated
- Unittests fixes
- Fixed debug mode handling
- Unified command type/support routine
- Nested attrs getter/setter
Change-Id: I3ade693ac21536e2b5dcee4b24d511749dc72759
Related-PROD: PROD-35811
diff --git a/cfg_checker/modules/network/pinger.py b/cfg_checker/modules/network/pinger.py
index 5b12a94..17f8597 100644
--- a/cfg_checker/modules/network/pinger.py
+++ b/cfg_checker/modules/network/pinger.py
@@ -5,22 +5,24 @@
from cfg_checker.helpers.console_utils import Progress
from cfg_checker.modules.network.mapper import NetworkMapper
from cfg_checker.modules.network.network_errors import NetworkErrors
-from cfg_checker.nodes import salt_master
+from cfg_checker.nodes import SaltNodes
# This is independent class with a salt.nodes input
class NetworkPinger(object):
def __init__(
self,
+ config,
mtu=None,
detailed=False,
errors_class=None,
skip_list=None,
skip_list_file=None
):
- logger_cli.info("# Initializing")
+ logger_cli.info("# Initializing Pinger")
+ self.salt_master = SaltNodes(config)
# all active nodes in the cloud
- self.target_nodes = salt_master.get_nodes(
+ self.target_nodes = self.salt_master.get_nodes(
skip_list=skip_list,
skip_list_file=skip_list_file
)
@@ -117,7 +119,7 @@
# do ping of packets
logger_cli.info("# Pinging nodes: MTU={}".format(self.target_mtu))
- salt_master.prepare_script_on_active_nodes("ping.py")
+ self.salt_master.prepare_script_on_active_nodes("ping.py")
_progress = Progress(_count)
_progress_index = 0
_node_index = 0
@@ -125,13 +127,13 @@
_targets = src_data["targets"]
_node_index += 1
# create 'targets.json' on source host
- _path = salt_master.prepare_json_on_node(
+ _path = self.salt_master.prepare_json_on_node(
src,
_targets,
"targets.json"
)
# execute ping.py
- _results = salt_master.execute_script_on_node(
+ _results = self.salt_master.execute_script_on_node(
src,
"ping.py",
args=[_path]