def get_glanceclient():
    session = get_session()
    token = session.get_token()
    region = None
    if 'OS_REGION_NAME' in env:
        region = env['OS_REGION_NAME']
    endpoint = session.get_endpoint(service_type='image', region_name=region)
    return glanceclient.Client(version='1', endpoint=endpoint, token=token)
def get_glanceclient():
    session = get_session()
    token = session.get_token()
    region = None
    if 'OS_REGION_NAME' in env:
        region = env['OS_REGION_NAME']
    endpoint = session.get_endpoint(service_type='image', region_name=region)
    return glanceclient.Client(version='1', endpoint=endpoint, token=token)
    def get_glanceclient(self):
        """Get a glance client. A client is different for each region
        (although all clients share the same session and it is possible to have
         simultaneously clients to several regions).

         Before calling this method, the credential must be provided. The
         constructor obtain the credential for environment variables if present
         but also the method set_credential is available.

         Be aware that calling the method set_credential invalidate the old
         session if already existed and therefore can affect the old clients.

        :return: a glance client valid for a region.
        """

        session = self.get_session()
        token = session.get_token()
        endpoint = session.get_endpoint(service_type='image',
                                        region_name=self.region)
        return glanceclient.Client(version='1', endpoint=endpoint, token=token)
Exemple #4
0
    def get_glanceclient(self):
        """Get a glance client. A client is different for each region
        (although all clients share the same session and it is possible to have
         simultaneously clients to several regions).

         Before calling this method, the credential must be provided. The
         constructor obtain the credential for environment variables if present
         but also the method set_credential is available.

         Be aware that calling the method set_credential invalidate the old
         session if already existed and therefore can affect the old clients.

        :return: a glance client valid for a region.
        """
        self._require_module('glance')
        session = self.get_session()
        token = session.get_token()
        endpoint = session.get_endpoint(service_type='image',
                                        region_name=self.region)
        return self._modules_imported['glance'].Client(
            version='1', endpoint=endpoint, token=token)