本文整理匯總了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())