def get_backend_instance(name):
 LOG.debug(('Retrieving backend instance for backend "%s"' % name))
 try:
  manager = DriverManager(namespace=BACKENDS_NAMESPACE, name=name, invoke_on_load=False)
 except RuntimeError:
  message = ('Invalid authentication backend specified: %s' % name)
  LOG.exception(message)
  raise ValueError(message)
 backend_kwargs = cfg.CONF.auth.backend_kwargs
 if backend_kwargs:
  try:
   kwargs = json.loads(backend_kwargs)
  except ValueError as e:
   raise ValueError(('Failed to JSON parse backend settings for backend "%s": %s' % (name, str(e))))
 else:
  kwargs = {}
 cls = manager.driver
 try:
  cls_instance = cls(**kwargs)
 except Exception as e:
  tb_msg = traceback.format_exc()
  class_name = cls.__name__
  msg = ('Failed to instantiate auth backend "%s" (class %s) with backend settings "%s": %s' % (name, class_name, str(kwargs), str(e)))
  msg += ('\n\n' + tb_msg)
  exc_cls = type(e)
  raise exc_cls(msg)
 return cls_instance

def get_backend_instance ( name ) : LOG . debug ( ( 'Retrieving backend instance for backend "%s"' % name ) ) try : manager = DriverManager ( namespace = BACKENDS_NAMESPACE , name = name , invoke_on_load = False ) except RuntimeError : message = ( 'Invalid authentication backend specified: %s' % name ) LOG . exception ( message ) raise ValueError ( message ) backend_kwargs = cfg . CONF . auth . backend_kwargs if backend_kwargs : try : kwargs = json . loads ( backend_kwargs ) except ValueError as e : raise ValueError ( ( 'Failed to JSON parse backend settings for backend "%s": %s' % ( name , str ( e ) ) ) ) else : kwargs = { } cls = manager . driver try : cls_instance = cls ( ** kwargs ) except Exception as e : tb_msg = traceback . format_exc ( ) class_name = cls . __name__ msg = ( 'Failed to instantiate auth backend "%s" (class %s) with backend settings "%s": %s' % ( name , class_name , str ( kwargs ) , str ( e ) ) ) msg += ( '\n\n' + tb_msg ) exc_cls = type ( e ) raise exc_cls ( msg ) return cls_instance
retrieve a class instance for the provided auth backend .