本文整理汇总了Python中keystoneclient.auth.identity.v2.Password方法的典型用法代码示例。如果您正苦于以下问题:Python v2.Password方法的具体用法?Python v2.Password怎么用?Python v2.Password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keystoneclient.auth.identity.v2
的用法示例。
在下文中一共展示了v2.Password方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_keystone_client
# 需要导入模块: from keystoneclient.auth.identity import v2 [as 别名]
# 或者: from keystoneclient.auth.identity.v2 import Password [as 别名]
def _get_keystone_client(self):
"""returns a keystone client instance"""
if self._keystone_client is None:
'''
self._keystone_client = keystoneclient.v2_0.client.Client(
auth_url=os.environ.get('OS_AUTH_URL'),
username=os.environ.get('OS_USERNAME'),
password=os.environ.get('OS_PASSWORD'),
tenant_name=os.environ.get('OS_TENANT_NAME'))
'''
auth = v2.Password(auth_url=os.environ.get('OS_AUTH_URL'),
username=os.environ.get('OS_USERNAME'),
password=os.environ.get('OS_PASSWORD'),
tenant_name=os.environ.get('OS_TENANT_NAME'))
sess = session.Session(auth=auth)
else:
return self._keystone_client
return sess
示例2: __init__
# 需要导入模块: from keystoneclient.auth.identity import v2 [as 别名]
# 或者: from keystoneclient.auth.identity.v2 import Password [as 别名]
def __init__(self, controller_ip, user='admin', passwd='admin',
tenant='admin'):
"""Create API client for manila service"""
super(ManilaActions, self).__init__(controller_ip,
user, passwd,
tenant)
auth_url, cert_path = self.__make_auth_url(controller_ip)
auth = v2.Password(auth_url=auth_url, username=user,
password=passwd, tenant_name=tenant)
if not DISABLE_SSL:
if VERIFY_SSL:
self.__keystone_ses = KeystoneSession(
auth=auth, ca_cert=cert_path)
else:
self.__keystone_ses = KeystoneSession(
auth=auth, verify=False)
else:
self.__keystone_ses = KeystoneSession(
auth=auth)
示例3: __init__
# 需要导入模块: from keystoneclient.auth.identity import v2 [as 别名]
# 或者: from keystoneclient.auth.identity.v2 import Password [as 别名]
def __init__(self, endpoint, **kwargs):
try:
from keystoneclient.v2_0 import client
from keystoneclient.auth.identity import v2
from keystoneclient import session
except ImportError:
if six.PY2:
apt_install(["python-keystoneclient"], fatal=True)
else:
apt_install(["python3-keystoneclient"], fatal=True)
from keystoneclient.v2_0 import client
from keystoneclient.auth.identity import v2
from keystoneclient import session
self.api_version = 2
token = kwargs.get("token", None)
if token:
api = client.Client(endpoint=endpoint, token=token)
else:
auth = v2.Password(username=kwargs.get("username"),
password=kwargs.get("password"),
tenant_name=kwargs.get("tenant_name"),
auth_url=endpoint)
sess = session.Session(auth=auth)
api = client.Client(session=sess)
self.api = api