當前位置: 首頁>>代碼示例>>Python>>正文


Python plugin.BaseAuthPlugin方法代碼示例

本文整理匯總了Python中keystoneauth1.plugin.BaseAuthPlugin方法的典型用法代碼示例。如果您正苦於以下問題:Python plugin.BaseAuthPlugin方法的具體用法?Python plugin.BaseAuthPlugin怎麽用?Python plugin.BaseAuthPlugin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在keystoneauth1.plugin的用法示例。


在下文中一共展示了plugin.BaseAuthPlugin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: ironic_client

# 需要導入模塊: from keystoneauth1 import plugin [as 別名]
# 或者: from keystoneauth1.plugin import BaseAuthPlugin [as 別名]
def ironic_client(self):
        # Trigger discovery from ksa. This will make ironicclient and
        # keystoneauth1.adapter.Adapter code paths both go through discovery.
        # ironicclient does its own magic with discovery, so we won't
        # pass an endpoint_override here like we do for keystoneclient.
        # Just so it's not wasted though, make sure we can handle the
        # min microversion we need.
        needed = self._get_legacy_ironic_microversion()

        # TODO(mordred) Bug in ksa - don't do microversion matching for
        # auth_type = admin_token. Remove this if when the fix lands.
        if (hasattr(plugin.BaseAuthPlugin, 'get_endpoint_data') or
                self.cloud_config.config['auth_type'] not in (
                    'admin_token', 'none')):
            # TODO(mordred) once we're on REST properly, we need a better
            # method for matching requested and available microversion
            endpoint_data = self._baremetal_client.get_endpoint_data()
            if not endpoint_data.min_microversion:
                raise exc.OpenStackCloudException(
                    "shade needs an ironic that supports microversions")
            if endpoint_data.min_microversion[1] > int(needed[-1]):
                raise exc.OpenStackCloudException(
                    "shade needs an ironic that supports microversion {needed}"
                    " but the ironic found has a minimum microversion"
                    " of {found}".format(
                        needed=needed,
                        found=self._join_ksa_version(
                            endpoint_data.min_microversion)))
            if endpoint_data.max_microversion[1] < int(needed[-1]):
                raise exc.OpenStackCloudException(
                    "shade needs an ironic that supports microversion {needed}"
                    " but the ironic found has a maximum microversion"
                    " of {found}".format(
                        needed=needed,
                        found=self._join_ksa_version(
                            endpoint_data.max_microversion)))

        return self._create_legacy_client(
            'ironic', 'baremetal',
            module_name='ironicclient.client.Client',
            os_ironic_api_version=self._get_legacy_ironic_microversion()) 
開發者ID:openstack,項目名稱:shade,代碼行數:43,代碼來源:_legacy_clients.py


注:本文中的keystoneauth1.plugin.BaseAuthPlugin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。