コード例 #1
0
def get_client(session=None):
    """Get a client object from the keystone service"""

    from goldstone.utils import get_cloud
    from keystoneclient.v3 import client
    if session is None:
        cloud = get_cloud()
        session = get_session(cloud=cloud)

    return client.Client(session=session)
コード例 #2
0
ファイル: utils.py プロジェクト: joraldaz/goldstone-server
def get_client(session=None):
    """Get a client object from the keystone service"""

    from goldstone.utils import get_cloud
    from keystoneclient.v3 import client
    if session is None:
        cloud = get_cloud()
        session = get_session(cloud=cloud)

    return client.Client(session=session)
コード例 #3
0
def get_session(cloud=None):
    """Get a keystone session that can be used to create clients for this and
    other services.  Assumes v2 semantics."""

    from goldstone.utils import get_cloud
    from keystoneclient.auth.identity import v2
    from keystoneclient import session

    if cloud is None:
        cloud = get_cloud()

    auth = v2.Password(username=cloud.username,
                       tenant_name=cloud.tenant_name,
                       password=cloud.password,
                       auth_url=cloud.auth_url)

    return session.Session(auth=auth)
コード例 #4
0
ファイル: utils.py プロジェクト: joraldaz/goldstone-server
def get_session(cloud=None):
    """Get a keystone session that can be used to create clients for this and
    other services.  Assumes v2 semantics."""

    from goldstone.utils import get_cloud
    from keystoneclient.auth.identity import v2
    from keystoneclient import session

    if cloud is None:
        cloud = get_cloud()

    auth = v2.Password(
        username=cloud.username,
        tenant_name=cloud.tenant_name,
        password=cloud.password,
        auth_url=cloud.auth_url)

    return session.Session(auth=auth)