Пример #1
0
    def sysinv(self):
        if self._sysinv is None:
            # TOX cannot import cgts_client and all the dependencies therefore
            # the client is being lazy loaded since TOX doesn't actually
            # require the cgtsclient module.
            from cgtsclient import client as cgts_client

            endpoint = self.admin_token.get_service_url(
                self.conf['region_name'], "sysinv", "platform", 'admin')
            self._sysinv = cgts_client.Client(sysinv.API_VERSION,
                                              endpoint=endpoint,
                                              token=self.admin_token.get_id())

        return self._sysinv
Пример #2
0
    def update_client(self, api_version, region_name, session):
        try:
            endpoint = self.session.get_endpoint(
                service_type=consts.ENDPOINT_TYPE_PLATFORM,
                interface=consts.KS_ENDPOINT_INTERNAL,
                region_name=region_name)
            token = session.get_token()
            client = cgts_client.Client(api_version,
                                        endpoint=endpoint,
                                        token=token)
        except exceptions.ServiceUnavailable:
            raise

        self._expired = False

        return client
    def __init__(self, region, session):
        try:
            # TOX cannot import cgts_client and all the dependencies therefore
            # the client is being lazy loaded since TOX doesn't actually
            # require the cgtsclient module.
            from cgtsclient import client

            # The sysinv client doesn't support a session, so we need to
            # get an endpoint and token.
            endpoint = session.get_endpoint(service_type='platform',
                                            region_name=region,
                                            interface='internal')
            token = session.get_token()

            self.sysinv_client = client.Client(API_VERSION,
                                               endpoint=endpoint,
                                               token=token)
        except exceptions.ServiceUnavailable:
            raise