From d84167e06dd4d607e86a0f5599d95eee331ce907 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Thu, 26 Aug 2010 21:28:11 +0000 Subject: Tools/__init__.py: Autoload client tools present in the Tools directory Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@6037 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/__init__.py | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/lib/Client/Tools/__init__.py b/src/lib/Client/Tools/__init__.py index 59f66612d..1216fb60a 100644 --- a/src/lib/Client/Tools/__init__.py +++ b/src/lib/Client/Tools/__init__.py @@ -1,30 +1,4 @@ """This contains all Bcfg2 Tool modules""" -__revision__ = '$Revision$' - -__all__ = ["Action", - "APT", - "Blast", - "Chkconfig", - "DebInit", - "Encap", - "IPS", - "FreeBSDInit", - "FreeBSDPackage", - "launchd", - "MacPorts", - "Portage", - "POSIX", - "RPMng", - "rpmtools", - "RcUpdate", - "SMF", - "SYSV", - "Upstart", - "YUMng"] - -drivers = [item for item in __all__ if item not in ['rpmtools']] -default = [item for item in drivers if item not in ['RPM', 'Yum']] - # suppress popen2 warnings for python 2.3 import warnings warnings.filterwarnings("ignore", "The popen2 module is deprecated.*", @@ -36,6 +10,15 @@ import sys import time import Bcfg2.Client.XML +__revision__ = '$Revision$' + +__all__ = [tool.split('.')[0] \ + for tool in os.listdir(os.path.dirname(__file__)) \ + if tool.endswith(".py") and tool != "__init__.py"] + +drivers = [item for item in __all__ if item not in ['rpmtools']] +default = [item for item in drivers if item not in ['RPM', 'Yum']] + class toolInstantiationError(Exception): """This error is called if the toolset cannot be instantiated.""" -- cgit v1.2.3-1-g7c22