# Path: blazar/context.py
# CONF = cfg.CONF
#     FROM_DICT_EXTRA_KEYS = ['service_catalog']
# class BlazarContext(context.RequestContext):
#     def __init__(self, service_catalog=None, **kwargs):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
#     def current(cls):
#     def to_dict(self):
#     def admin(cls):
# def current():
# def admin():
# 
# Path: blazar/utils/openstack/base.py
# CONF = cfg.CONF
# def get_os_auth_host(conf):
# def url_for(service_catalog, service_type, admin=False,
#             endpoint_interface=None,
#             os_region_name=None):


import uuid as uuidgen
from keystoneauth1 import session
from keystoneauth1 import token_endpoint
from novaclient import client as nova_client
from novaclient import exceptions as nova_exception
from novaclient.v2 import servers
from oslo_config import cfg
from oslo_log import log as logging
from blazar import context
from blazar.manager import exceptions as manager_exceptions
from blazar.plugins import oshosts
from blazar.utils.openstack import base
        ctx = kwargs.pop('ctx', None)
        auth_token = kwargs.pop('auth_token', None)
        endpoint_override = kwargs.pop('endpoint_override', None)
        version = kwargs.pop('version', CONF.nova.nova_client_version)
        username = kwargs.pop('username', None)
        password = kwargs.pop('password', None)
        user_domain_name = kwargs.pop('user_domain_name', None)
        project_name = kwargs.pop('project_name', None)
        project_domain_name = kwargs.pop('project_domain_name', None)
        auth_url = kwargs.pop('auth_url', None)

        if ctx is None:
            try:
                ctx = context.current()
            except RuntimeError:
                pass
        if ctx is not None:
            auth_token = auth_token or ctx.auth_token
            endpoint_override = endpoint_override or \
                base.url_for(ctx.service_catalog,
                             CONF.nova.compute_service,
                             endpoint_interface=CONF.nova.endpoint_type,
                             os_region_name=CONF.os_region_name)
            auth_url = base.url_for(ctx.service_catalog, CONF.identity_service,
                                    CONF.endpoint_type,
                                    os_region_name=CONF.os_region_name)
            kwargs.setdefault('global_request_id', ctx.global_request_id)

        if auth_url is None:
            auth_url = "%s://%s:%s" % (CONF.os_auth_protocol,

# Path: blazar/context.py
# CONF = cfg.CONF
#     FROM_DICT_EXTRA_KEYS = ['service_catalog']
# class BlazarContext(context.RequestContext):
#     def __init__(self, service_catalog=None, **kwargs):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
#     def current(cls):
#     def to_dict(self):
#     def admin(cls):
# def current():
# def admin():
# 
# Path: blazar/utils/openstack/base.py
# CONF = cfg.CONF
# def get_os_auth_host(conf):
# def url_for(service_catalog, service_type, admin=False,
#             endpoint_interface=None,
#             os_region_name=None):


# Path: blazar/utils/openstack/nova.py
import uuid as uuidgen
from keystoneauth1 import session
from keystoneauth1 import token_endpoint
from novaclient import client as nova_client
from novaclient import exceptions as nova_exception
from novaclient.v2 import servers
from oslo_config import cfg
from oslo_log import log as logging
from blazar import context
from blazar.manager import exceptions as manager_exceptions
from blazar.plugins import oshosts
from blazar.utils.openstack import base

        ctx = kwargs.pop('ctx', None)
        auth_token = kwargs.pop('auth_token', None)
        endpoint_override = kwargs.pop('endpoint_override', None)
        version = kwargs.pop('version', CONF.nova.nova_client_version)
        username = kwargs.pop('username', None)
        password = kwargs.pop('password', None)
        user_domain_name = kwargs.pop('user_domain_name', None)
        project_name = kwargs.pop('project_name', None)
        project_domain_name = kwargs.pop('project_domain_name', None)
        auth_url = kwargs.pop('auth_url', None)

        if ctx is None:
            try:
                ctx = context.current()
            except RuntimeError:
                pass
        if ctx is not None:
            auth_token = auth_token or ctx.auth_token
            endpoint_override = endpoint_override or \
                base.url_for(ctx.service_catalog,
                             CONF.nova.compute_service,
                             endpoint_interface=CONF.nova.endpoint_type,
                             os_region_name=CONF.os_region_name)
            auth_url = base.url_for(ctx.service_catalog, CONF.identity_service,
                                    CONF.endpoint_type,
                                    os_region_name=CONF.os_region_name)
            kwargs.setdefault('global_request_id', ctx.global_request_id)

        if auth_url is None:
            auth_url = "%s://%s:%s" % (CONF.os_auth_protocol,

                                       base.get_os_auth_host(CONF),