# 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/exceptions.py
# class ResourceProviderRetrievalFailed(exceptions.BlazarException):
# class ResourceProviderCreationFailed(exceptions.BlazarException):
# class ResourceProviderCreationConflict(exceptions.BlazarException):
# class ResourceProviderDeletionFailed(exceptions.BlazarException):
# class ResourceClassCreationFailed(exceptions.BlazarException):
# class ResourceClassDeletionFailed(exceptions.BlazarException):
# class ResourceProviderNotFound(exceptions.BlazarException):
# class InventoryUpdateFailed(exceptions.BlazarException):
# class InventoryConflict(exceptions.BlazarException):
# class FloatingIPNetworkNotFound(exceptions.InvalidInput):
# class FloatingIPSubnetNotFound(exceptions.NotFound):
# class NeutronUsesFloatingIP(exceptions.InvalidInput):


import retrying
from keystoneauth1 import adapter
from keystoneauth1.identity import v3
from keystoneauth1 import session
from oslo_config import cfg
from oslo_log import log as logging
from blazar import context
from blazar.utils.openstack import base
from blazar.utils.openstack import exceptions

        resp = self.post(url, payload)

        if resp:
            msg = ("Created resource provider record via placement API for "
                   "resource provider %(name)s.")
            args = {'name': rp_name}
            LOG.info(msg, args)
            return resp.json()

        if resp.status_code == 409:
            msg = ("Conflict on creating resource provider %(name)s in "
                   "placement API. Got %(status_code)d: %(err_text)s.")
            args = {
                'name': rp_name,
                'status_code': resp.status_code,
                'err_text': resp.text,
            }
            LOG.error(msg, args)
            raise exceptions.ResourceProviderCreationConflict(name=rp_name)

        msg = ("Failed to create resource provider record in placement API "
               "for resource provider %(name)s. "
               "Got %(status_code)d: %(err_text)s.")
        args = {
            'name': rp_name,
            'status_code': resp.status_code,
            'err_text': resp.text,
        }
        LOG.error(msg, args)

# 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/exceptions.py
# class ResourceProviderRetrievalFailed(exceptions.BlazarException):
# class ResourceProviderCreationFailed(exceptions.BlazarException):
# class ResourceProviderCreationConflict(exceptions.BlazarException):
# class ResourceProviderDeletionFailed(exceptions.BlazarException):
# class ResourceClassCreationFailed(exceptions.BlazarException):
# class ResourceClassDeletionFailed(exceptions.BlazarException):
# class ResourceProviderNotFound(exceptions.BlazarException):
# class InventoryUpdateFailed(exceptions.BlazarException):
# class InventoryConflict(exceptions.BlazarException):
# class FloatingIPNetworkNotFound(exceptions.InvalidInput):
# class FloatingIPSubnetNotFound(exceptions.NotFound):
# class NeutronUsesFloatingIP(exceptions.InvalidInput):


# Path: blazar/utils/openstack/placement.py
import retrying
from keystoneauth1 import adapter
from keystoneauth1.identity import v3
from keystoneauth1 import session
from oslo_config import cfg
from oslo_log import log as logging
from blazar import context
from blazar.utils.openstack import base
from blazar.utils.openstack import exceptions


        resp = self.post(url, payload)

        if resp:
            msg = ("Created resource provider record via placement API for "
                   "resource provider %(name)s.")
            args = {'name': rp_name}
            LOG.info(msg, args)
            return resp.json()

        if resp.status_code == 409:
            msg = ("Conflict on creating resource provider %(name)s in "
                   "placement API. Got %(status_code)d: %(err_text)s.")
            args = {
                'name': rp_name,
                'status_code': resp.status_code,
                'err_text': resp.text,
            }
            LOG.error(msg, args)
            raise exceptions.ResourceProviderCreationConflict(name=rp_name)

        msg = ("Failed to create resource provider record in placement API "
               "for resource provider %(name)s. "
               "Got %(status_code)d: %(err_text)s.")
        args = {
            'name': rp_name,
            'status_code': resp.status_code,
            'err_text': resp.text,
        }
        LOG.error(msg, args)

        raise exceptions.ResourceProviderCreationFailed(name=rp_name)