Node skip on no IF in reclass
diff --git a/cfg_checker/modules/network/checker.py b/cfg_checker/modules/network/checker.py
index f40e1d3..5989a39 100644
--- a/cfg_checker/modules/network/checker.py
+++ b/cfg_checker/modules/network/checker.py
@@ -96,7 +96,15 @@
continue
# get the reclass value
_pillar = self.nodes[node]['pillars']['linux']['network']
- _pillar = _pillar['interface']
+ # we should be ready if there is no interface in reclass for a node
+ # for example on APT node
+ if 'interface' in _pillar:
+ _pillar = _pillar['interface']
+ else:
+ logger_cli.info("...skipped '{}', no IF in reclass".format(
+ node
+ ))
+ continue
for _if_name, _if_data in _pillar.iteritems():
if 'address' in _if_data:
_if = ipaddress.IPv4Interface(
diff --git a/cfg_checker/nodes.py b/cfg_checker/nodes.py
index 30de749..b2bfd88 100644
--- a/cfg_checker/nodes.py
+++ b/cfg_checker/nodes.py
@@ -83,6 +83,18 @@
)
)
+ def skip_node(self, node):
+ # Add node to skip list
+ # Fro example if it is fails to comply with the rules
+
+ # check if we know such node
+ if node in self.nodes.keys() and node not in self.skip_list:
+ # yes, add it
+ self.skip_list.append(node)
+ return True
+ else:
+ return False
+
def get_nodes(self):
return self.nodes