Migrating to Python v3
- support for Python v3.8.x
- support for Python v3.5.x
- new tag, 2019.2.8
- updates class generation and iterators
- unittests updated with coverage >75%
- new coverage routines
- unittests profiling
- full fake data for unittests
- unittest testrun is ~1.5 seconds long
Bugfixes
- 34834, proper use of 'sudo' option
- multiple proper iterator use
- 37919, show warning when installed and candidate versions
are newer comparing to release version
Change-Id: Idd6b889f7ce94ae0c832e2f0a0346e4fdc3264a3
Related-PROD: PROD-34834 PROD-34664 PROD-34919
diff --git a/cfg_checker/nodes.py b/cfg_checker/nodes.py
index ec20f6a..c261752 100644
--- a/cfg_checker/nodes.py
+++ b/cfg_checker/nodes.py
@@ -35,7 +35,7 @@
try:
_keys = self.salt.list_keys()
_str = []
- for _k, _v in _keys.iteritems():
+ for _k, _v in _keys.items():
_str.append("{}: {}".format(_k, len(_v)))
logger_cli.info("-> keys collected: {}".format(", ".join(_str)))
@@ -92,10 +92,12 @@
)
)
# get master node fqdn
- _filtered = filter(
- lambda nd: self.nodes[nd]['role'] == const.all_roles_map['cfg'],
- self.nodes
- )
+ # _filtered = filter(
+ # lambda nd: self.nodes[nd]['role'] == const.all_roles_map['cfg'],
+ # self.nodes
+ # )
+ _role = const.all_roles_map['cfg']
+ _filtered = [n for n, v in self.nodes.items() if v['role'] == _role]
if len(_filtered) < 1:
raise SaltException(
"No master node detected! Check/Update node role map."
@@ -161,7 +163,7 @@
else:
_nodes = self.nodes
_result = self.execute_cmd_on_active_nodes(cmd, nodes=nodes)
- for node, data in _nodes.iteritems():
+ for node, data in _nodes.items():
if node in self.skip_list:
logger_cli.debug(
@@ -200,7 +202,7 @@
)
_result = self.salt.pillar_get(self.active_nodes_compound, pillar_path)
self.not_responded = []
- for node, data in self.nodes.iteritems():
+ for node, data in self.nodes.items():
if node in self.skip_list:
logger_cli.debug(
"... '{}' skipped while collecting '{}'".format(