def parse(): """ main entry point. """ from testpool.core import commands from testpool.core import logger logger = logger.create() arg_parser = commands.main() args = arg_parser.parse_args() try: return commands.args_process(logger, args) except Exception, arg: if logger.isEnabledFor(logging.DEBUG): logger.exception(arg) else: logger.error(arg) return 1
""" Provide infrastructure for defining and supporting exceptions. """ import sys import logging from testpool.core import logger LOG = logger.create() class TestpoolError(Exception): """ Common to all Testpool exceptions. """ def __init__(self, message): # pylint: disable=W0235 """ Constructor. """ super(TestpoolError, self).__init__(message) class ConnectionError(Exception): """ When unable to connect to a resource. """ def __init__(self, message): # pylint: disable=W0235 """ Constructor. """ super(ConnectionError, self).__init__(message) class PoolError(TestpoolError): """ Thrown when a pool is considered bad. """ def __init__(self, message, pool_error): """ Constructor. """ super(PoolError, self).__init__(message) self.pool = pool_error
""" API for KVM hypervisors. """ import sys import os from xml.etree import ElementTree import libvirt import testpool.core.api from testpool.core import exceptions from testpool.core import logger LOGGER = logger.create() ## # Because KVM support is bunbled with testpool, we do not want to # fail if the intent is to not use it. # pylint: disable=E0401 try: import virtinst.cloner as cloner import virtinst.connection except ImportError: VIRTINST_DIR = os.path.join("/usr", "share", "virt-manager") if os.path.exists(VIRTINST_DIR) and VIRTINST_DIR not in sys.path: sys.path.append(VIRTINST_DIR) import virtinst.cloner as cloner import virtinst.connection # pylint: enable=E0401 ## ##
""" API for KVM hypervisors. """ import sys import os from xml.etree import ElementTree import libvirt import testpool.core.api from testpool.core import exceptions from testpool.core import logger LOGGER = logger.create() ## # Because KVM support is bunbled with testpool, we do not want to # fail if the intent is to not use it. # pylint: disable=E0401 try: import virtinst.cloner as cloner import virtinst.connection except ImportError: VIRTINST_DIR = os.path.join("/usr", "share", "virt-manager") if os.path.exists(VIRTINST_DIR) and VIRTINST_DIR not in sys.path: sys.path.append(VIRTINST_DIR) import virtinst.cloner as cloner import virtinst.connection # pylint: enable=E0401 ##
""" Provide infrastructure for defining and supporting exceptions. """ import sys import logging from testpool.core import logger LOG = logger.create() class TestpoolError(Exception): """ Common to all Testpool exceptions. """ def __init__(self, message): # pylint: disable=W0235 """ Constructor. """ super(TestpoolError, self).__init__(message) class ConnectionError(Exception): """ When unable to connect to a resource. """ def __init__(self, message): # pylint: disable=W0235 """ Constructor. """ super(ConnectionError, self).__init__(message) class PoolError(TestpoolError): """ Thrown when a pool is considered bad. """ def __init__(self, message, pool_error):