Skip nodes functionality for Package and Network modules
Added to main entrypoint
- Skip nodes using simple argument with '*' as a trailing wildcard
- Skip nodes using file list
Usability improovement
- Node list preview in status line
- Node stats alignment in net report
Minor fixes:
- Python version detection (3.5+)
- Node counter for each status
- Proper node skip handling
Change-Id: I086ef501bc06f0e739df25349257f1c63a2e2fcf
Related-PROD: PROD-35009
diff --git a/cfg_checker/common/settings.py b/cfg_checker/common/settings.py
index 92c17a5..cca5142 100644
--- a/cfg_checker/common/settings.py
+++ b/cfg_checker/common/settings.py
@@ -1,4 +1,5 @@
import os
+import sys
from cfg_checker.common.exception import ConfigException
@@ -15,11 +16,17 @@
class CheckerConfiguration(object):
+ @staticmethod
def load_nodes_list():
- return utils.get_nodes_list(
- os.environ.get('CFG_ALL_NODES', None),
- os.environ.get('SALT_NODE_LIST_FILE', None)
- )
+ _file = os.environ.get('SALT_NODE_LIST_FILE', None)
+ if _file:
+ _v, _ = utils.get_nodes_list(
+ os.path.join(pkg_dir, _file),
+ env_sting=os.environ.get('CFG_ALL_NODES', None)
+ )
+ return _v
+ else:
+ return None
def _init_values(self):
"""Load values from environment variables or put default ones
@@ -119,6 +126,16 @@
def __init__(self):
"""Base configuration class. Only values that are common for all scripts
"""
+ # Make sure we running on Python 3
+ if sys.version_info[0] < 3 and sys.version_info[1] < 5:
+ logger_cli.error("# ERROR: Python 3.5+ is required")
+ sys.exit(1)
+ else:
+ logger_cli.debug("### Python version is {}.{}".format(
+ sys.version_info[0],
+ sys.version_info[1]
+ ))
+
_env = os.getenv('SALT_ENV', None)
self._init_env(_env)
self._init_values()