From ba33eda4f9ad307178668c2634de6bec1c53a0d3 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Mon, 19 Oct 2015 04:36:45 +0100 Subject: exclude files from the search in the Loader New configuration parameter EXCLUDE_MODULES defines module names, which won't be automatically loaded by LoaderServant. It can be used to exclude obsolete or abstract modules. Change-Id: If98b50b1505465bcedcf28fe63421c73a4fe160a JIRA: VSPERF-118 Signed-off-by: Martin Klozik Reviewed-by: Billy O Mahony Reviewed-by: Maryam Tahhan Reviewed-by: Fatih Degirmenci Reviewed-by: Gene Snider Reviewed-by: Al Morton Reviewed-by: Tv Rao Reviewed-by: Brian Castelli --- conf/00_common.conf | 10 ++++++++++ core/loader/loader_servant.py | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/conf/00_common.conf b/conf/00_common.conf index ef1c6280..51dceb32 100644 --- a/conf/00_common.conf +++ b/conf/00_common.conf @@ -59,3 +59,13 @@ VERBOSITY = 'debug' # from anywhere in the test framework so be careful with naming # conventions TEST_PARAMS = {} + +# ############################ +# Modules +# ############################ + +# following modules will be excluded from automatic load by LoaderServant +# it can be used to suppress automatic load of obsoleted or abstract modules +# Example: +# EXCLUDE_MODULES = ['ovs_vanilla', 'qemu_virtio_net', 'pidstat'] +EXCLUDE_MODULES = [] diff --git a/core/loader/loader_servant.py b/core/loader/loader_servant.py index 3b729c23..dc6353ff 100644 --- a/core/loader/loader_servant.py +++ b/core/loader/loader_servant.py @@ -26,6 +26,7 @@ from os import sys import imp import fnmatch import logging +from conf import settings class LoaderServant(object): @@ -167,6 +168,10 @@ class LoaderServant(object): for filename in fnmatch.filter(filenames, '[!.]*.py'): modname = os.path.splitext(os.path.basename(filename))[0] + # skip module load if it is excluded by configuration + if modname in settings.getValue('EXCLUDE_MODULES'): + continue + try: if modname in sys.modules: mod = sys.modules[modname] -- cgit