当前位置: 首页>>代码示例>>Python>>正文


Python v3.Password方法代码示例

本文整理汇总了Python中keystoneauth1.identity.v3.Password方法的典型用法代码示例。如果您正苦于以下问题:Python v3.Password方法的具体用法?Python v3.Password怎么用?Python v3.Password使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在keystoneauth1.identity.v3的用法示例。


在下文中一共展示了v3.Password方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_inspector_client

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def get_inspector_client(self):
        os_auth_url, os_tenant_name, os_username, os_password, \
            os_user_domain_name, os_project_domain_name = \
            CredentialHelper.get_undercloud_creds()
        auth_url = os_auth_url + "v3"

        kwargs = {
                'username': os_username,
                'password': os_password,
                'auth_url': os_auth_url,
                'project_id': os_tenant_name,
                'user_domain_name': os_user_domain_name,
                'project_domain_name': os_project_domain_name
                }
        auth = v3.Password(
            auth_url=auth_url,
            username=os_username,
            password=os_password,
            project_name=os_tenant_name,
            user_domain_name=os_user_domain_name,
            project_domain_name=os_project_domain_name
            )
        sess = session.Session(auth=auth)
        self.inspector = ironic_inspector_client.ClientV1(session=sess) 
开发者ID:dsp-jetpack,项目名称:JetPack,代码行数:26,代码来源:nfv_parameters.py

示例2: _get_client

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def _get_client(self):
        if self._client is not None:
            return self._client

        auth = v3_auth.Password(
            auth_url=self.auth_url,
            username=self.username,
            password=self.password,
            project_name=self.project_name,
            project_domain_name=self.project_domain_name,
            user_domain_name=self.user_domain_name,
        )

        session = ks_session.Session(auth=auth)
        self._client = client.Client(
            session=session,
            service_type=self.service_type,
            region_name=self.region_name,
        )
        return self._client 
开发者ID:openstack,项目名称:designate,代码行数:22,代码来源:impl_designate.py

示例3: tearDown

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def tearDown(self):
        auth = v3.Password(auth_url=self.auth_url,
                           username=self.username,
                           password=self.password,
                           project_name=self.project_name,
                           user_domain_id=self.user_domain_id,
                           project_domain_id=self.project_domain_id)
        sess = session.Session(auth=auth)
        swift = swiftclient.client.Connection(session=sess)

        for x in range(1, 4):
            time.sleep(x)
            try:
                _, objects = swift.get_container(self.container)
                for obj in objects:
                    swift.delete_object(self.container, obj.get('name'))
                swift.delete_container(self.container)
            except Exception:
                if x < 3:
                    pass
                else:
                    raise
            else:
                break
        super(TestSwift, self).tearDown() 
开发者ID:openstack,项目名称:glance_store,代码行数:27,代码来源:test_functional_swift.py

示例4: __init__

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def __init__(self):
        os_auth_url = os.getenv('OS_AUTH_URL')
        os_auth_url = os_auth_url.replace('v2.0', 'v3')
        if not os_auth_url.endswith('v3'):
            os_auth_url += '/v3'

        os_username = os.getenv('OS_USERNAME')
        os_password = os.getenv('OS_PASSWORD')
        os_tenant_name = os.getenv('OS_TENANT_NAME')
        os_region_name = os.getenv('OS_REGION_NAME')

        self.glance_endpoint = os_auth_url.replace('keystone/v3', 'glance')
        sys.stdout.write('Using glance endpoint: ' + self.glance_endpoint)

        v3_auth = v3.Password(auth_url = os_auth_url, username = os_username,
                              password = os_password, project_name = os_tenant_name,
                              project_domain_name = 'default', user_domain_name = 'default')
        self.sess = session.Session(auth=v3_auth, verify=False) # verify=True 
开发者ID:platform9,项目名称:openstack-omni,代码行数:20,代码来源:create-glance-images.py

示例5: _get_auth_session

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def _get_auth_session(cls, username, password, project_name,
                          project_domain_id, user_domain_id, auth_url,
                          insecure):
        """Return a `keystoneauth1.session.Session` from auth parameters."""
        # create v3Password auth plugin
        _auth = ksa_v3.Password(username=username,
                                password=password,
                                project_name=project_name,
                                project_domain_id=project_domain_id,
                                user_domain_id=user_domain_id,
                                auth_url=auth_url)

        # `insecure` is being replaced by `verify`. Please note they have
        # opposite meanings.
        verify = False if insecure else True

        # create a `keystoneauth1.session.Session`
        _session = ksa_session.Session(auth=_auth, verify=verify)

        return _session 
开发者ID:openstack,项目名称:magnum,代码行数:22,代码来源:python_client_base.py

示例6: _get_legacy_auth

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def _get_legacy_auth(self):
        LOG.warning('Auth plugin and its options for service user '
                    'must be provided in [%(new)s] section. '
                    'Using values from [%(old)s] section is '
                    'deprecated.', {'new': ksconf.CFG_GROUP,
                                    'old': ksconf.CFG_LEGACY_GROUP})

        conf = getattr(CONF, ksconf.CFG_LEGACY_GROUP)

        # FIXME(htruta, pauloewerton): Conductor layer does not have
        # new v3 variables, such as project_name and project_domain_id.
        # The use of admin_* variables is related to Identity API v2.0,
        # which is now deprecated. We should also stop using hard-coded
        # domain info, as well as variables that refer to `tenant`,
        # as they are also v2 related.
        auth = ka_v3.Password(auth_url=self.auth_url,
                              username=conf.admin_user,
                              password=conf.admin_password,
                              project_name=conf.admin_tenant_name,
                              project_domain_id='default',
                              user_domain_id='default')
        return auth 
开发者ID:openstack,项目名称:magnum,代码行数:24,代码来源:keystone.py

示例7: domain_admin_auth

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def domain_admin_auth(self):
        user_domain_id = (
            CONF.trust.trustee_domain_admin_domain_id or
            CONF.trust.trustee_domain_id
        )
        user_domain_name = (
            CONF.trust.trustee_domain_admin_domain_name or
            CONF.trust.trustee_domain_name
        )
        if not self._domain_admin_auth:
            self._domain_admin_auth = ka_v3.Password(
                auth_url=self.auth_url,
                user_id=CONF.trust.trustee_domain_admin_id,
                username=CONF.trust.trustee_domain_admin_name,
                user_domain_id=user_domain_id,
                user_domain_name=user_domain_name,
                domain_id=CONF.trust.trustee_domain_id,
                domain_name=CONF.trust.trustee_domain_name,
                password=CONF.trust.trustee_domain_admin_password)
        return self._domain_admin_auth 
开发者ID:openstack,项目名称:magnum,代码行数:22,代码来源:keystone.py

示例8: _get_client

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def _get_client(self, username, password, tenant_name=None):
        if tenant_name:
            auth = keystone_v2_auth.Password(
                auth_url=self.auth_url,
                username=username,
                password=password,
                tenant_name=tenant_name,
            )
        else:
            auth = keystone_v2_auth.Password(
                auth_url=self.auth_url, username=username, password=password
            )

        sess = session.Session(auth=auth)
        client = client_v2.Client(session=sess, timeout=self.timeout, debug=self.debug)
        return client, sess 
开发者ID:quay,项目名称:quay,代码行数:18,代码来源:keystone.py

示例9: get_qinling_endpoint

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def get_qinling_endpoint():
    '''Get Qinling service endpoint.'''
    if CONF.qinling_endpoint:
        return CONF.qinling_endpoint

    region = CONF.keystone_authtoken.region_name
    auth = v3.Password(
        auth_url=CONF.keystone_authtoken.www_authenticate_uri,
        username=CONF.keystone_authtoken.username,
        password=CONF.keystone_authtoken.password,
        project_name=CONF.keystone_authtoken.project_name,
        user_domain_name=CONF.keystone_authtoken.user_domain_name,
        project_domain_name=CONF.keystone_authtoken.project_domain_name,
    )
    sess = session.Session(auth=auth, verify=False)
    endpoint = sess.get_endpoint(service_type='function-engine',
                                 interface='public',
                                 region_name=region)

    return endpoint 
开发者ID:openstack,项目名称:qinling,代码行数:22,代码来源:keystone.py

示例10: get_session

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def get_session():
        """Get an initialized keystone session.

        Authentication is based on the keystone_authtoken section of the config file.
        """
        auth_info = dict()
        for f in [
                'auth_url', 'username', 'password', 'project_id',
                'user_domain_name'
        ]:
            auth_info[f] = getattr(config.config_mgr.conf.keystone_authtoken,
                                   f)

        auth = v3.Password(**auth_info)
        return session.Session(auth=auth) 
开发者ID:airshipit,项目名称:drydock,代码行数:17,代码来源:util.py

示例11: get_ks_session

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def get_ks_session(**kwargs):
        # Establishes a keystone session
        if 'token' in kwargs:
            auth = v3.TokenMethod(token=kwargs.get('token'))
        else:
            auth = v3.Password(**kwargs)
        return session.Session(auth=auth) 
开发者ID:airshipit,项目名称:drydock,代码行数:9,代码来源:session.py

示例12: _get_auth_plugin

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def _get_auth_plugin(auth_url, **kwargs):
    kwargs = {
        'username': kwargs.get('username'),
        'password': kwargs.get('password'),
        'project_name': kwargs.get('project_name'),
        'project_domain_id': kwargs.get('project_domain_id'),
        'user_domain_id': kwargs.get('user_domain_id'),
    }

    return v3.Password(auth_url=auth_url, **kwargs) 
开发者ID:monasca,项目名称:monasca-docker,代码行数:12,代码来源:preload.py

示例13: _get_keystone_pw

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def _get_keystone_pw(self, ks_version, auth_url, user, password, tenant_name):
        if int(ks_version) == 2:
            auth = v2.Password(
                auth_url=auth_url, username=user, password=password,
                tenant_name=tenant_name)
        elif int(ks_version) == 3:
            auth = v3.Password(
                auth_url=auth_url, username=user, password=password,
                project_name=tenant_name)
        else:
            raise a10_ex.InvalidConfig('keystone version must be protovol version 2 or 3')

        return self._get_keystone_stuff(ks_version, auth) 
开发者ID:a10networks,项目名称:a10-neutron-lbaas,代码行数:15,代码来源:keystone.py

示例14: _keystone_session

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def _keystone_session(self):
        """
        Connect to Keystone and return a session object.

        :rtype: :class:`keystoneauth1.session.Session`
        :return: A Keystone session object.
        """
        if self._cached_keystone_session:
            return self._cached_keystone_session

        if self._keystone_version == 3:
            from keystoneauth1.identity import v3
            auth = v3.Password(auth_url=self.auth_url,
                               username=self.username,
                               password=self.password,
                               user_domain_name=self.user_domain_name,
                               project_domain_id=self.project_domain_id,
                               project_domain_name=self.project_domain_name,
                               project_name=self.project_name)
            self._cached_keystone_session = session.Session(auth=auth)
        else:
            from keystoneauth1.identity import v2
            auth = v2.Password(self.auth_url, username=self.username,
                               password=self.password,
                               tenant_name=self.project_name)
            self._cached_keystone_session = session.Session(auth=auth)
        return self._cached_keystone_session 
开发者ID:CloudVE,项目名称:cloudbridge,代码行数:29,代码来源:provider.py

示例15: os_session

# 需要导入模块: from keystoneauth1.identity import v3 [as 别名]
# 或者: from keystoneauth1.identity.v3 import Password [as 别名]
def os_session(self):
        if self._os_session is None:
            from keystoneauth1.identity import v3
            from keystoneauth1.session import Session

            self._os_session = Session(
                auth=v3.Password(**self.configuration['os_auth']),
                verify=self.configuration['session'].get('cacert', False),
                cert=self.configuration['session'].get('cert'))
        return self._os_session 
开发者ID:F-Secure,项目名称:see,代码行数:12,代码来源:os_glance.py


注:本文中的keystoneauth1.identity.v3.Password方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。