Пример #1
0
def _get_auth_token():
    try:
        httpclient = client.HTTPClient(
            username=CONF.quantum_admin_username,
            tenant_name=CONF.quantum_admin_tenant_name,
            password=CONF.quantum_admin_password,
            auth_url=CONF.quantum_admin_auth_url,
            timeout=CONF.quantum_url_timeout,
            auth_strategy=CONF.quantum_auth_strategy)
        httpclient.authenticate()
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception(_("_get_auth_token() failed"))
    return httpclient.auth_token
Пример #2
0
def _get_auth_token(logger):
    httpclient = q_client.HTTPClient(
        username=CONF.quantum_admin_username,
        tenant_name=CONF.quantum_admin_tenant_name,
        password=CONF.quantum_admin_password,
        auth_url=CONF.quantum_admin_auth_url,
        timeout=CONF.quantum_url_timeout,
        auth_strategy=CONF.quantum_auth_strategy)
    try:
        httpclient.authenticate()
    except (q_exc.Unauthorized, q_exc.Forbidden, q_exc.EndpointNotFound) as e:
        logger.error("authentication failure: %s", e)
        return None
    # logger.debug("_get_auth_token: token=%s", httpclient.auth_token)
    return httpclient.auth_token
Пример #3
0
def _get_auth_token():
    try:
        httpclient = client.HTTPClient(
            username=CONF.quantum_admin_username,
            tenant_name=CONF.quantum_admin_tenant_name,
            region_name=CONF.quantum_region_name,
            password=CONF.quantum_admin_password,
            auth_url=CONF.quantum_admin_auth_url,
            timeout=CONF.quantum_url_timeout,
            auth_strategy=CONF.quantum_auth_strategy,
            insecure=CONF.quantum_api_insecure)
        httpclient.authenticate()
        return httpclient.auth_token
    except exceptions.QuantumClientException as e:
        with excutils.save_and_reraise_exception():
            LOG.error(_('Quantum client authentication failed: %s'), e)