Ejemplo n.º 1
0
def get_module(namespace, name):
    try:
        mgr = driver.DriverManager(namespace=namespace,
                                   name=name,
                                   invoke_on_load=False)
    except RuntimeError as e:
        raise exc.PluginFactoryError("Unable to load plugin %s.%s. %s" %
                                     (namespace, name, str(e)))

    return mgr.driver
Ejemplo n.º 2
0
def get_instance(namespace, name, *args, **kwargs):
    try:
        mgr = driver.DriverManager(namespace=namespace,
                                   name=name,
                                   invoke_on_load=True,
                                   invoke_args=args,
                                   invoke_kwds=kwargs)
    except RuntimeError as e:
        raise exc.PluginFactoryError('Unable to load plugin %s.%s. %s' %
                                     (namespace, name, str(e)))

    return mgr.driver