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


Python v2.Password方法代碼示例

本文整理匯總了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 
開發者ID:opnfv,項目名稱:qtip,代碼行數:23,代碼來源:create_zones.py

示例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) 
開發者ID:openstack,項目名稱:fuel-plugin-manila,代碼行數:23,代碼來源:os_manila_actions.py

示例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 
開發者ID:openstack,項目名稱:charm-swift-proxy,代碼行數:31,代碼來源:keystone.py


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