maas_common.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:rca-evaluation 作者: sieve-microservices 项目源码 文件源码
def get_heat_client(token=None, endpoint=None, previous_tries=0):
        if previous_tries > 3:
            return None

        # first try to use auth details from auth_ref so we
        # don't need to auth with keystone every time
        auth_ref = get_auth_ref()
        auth_details = get_auth_details()
        keystone = get_keystone_client(auth_ref)

        if not token:
            token = keystone.auth_token
        if not endpoint:
            endpoint = get_endpoint_url_for_service('orchestration',
                                                    auth_ref,
                                                    get_endpoint_type(
                                                        auth_details))

        heat = heat_client.Client('1',
                                  endpoint=endpoint,
                                  token=token,
                                  insecure=auth_details['OS_API_INSECURE'])
        try:
            heat.build_info.build_info()
        except h_exc.HTTPUnauthorized:
            auth_ref = force_reauth()
            keystone = get_keystone_client(auth_ref)

            token = keystone.auth_token
            heat = get_heat_client(token, endpoint, previous_tries + 1)
        except h_exc.HTTPException:
            raise
        except Exception as e:
            status_err(str(e))

        return heat
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号