def get_adapter(self):
        """get adapter."""
        status, resp = self.client.list_adapters(name=CONF.adapter_name)
        LOG.info(
            'get all adapters status: %s, resp: %s',
            status, resp
        )

        if not self.is_ok(status) or not resp:
            raise RuntimeError('failed to get adapters')

        os_re = re.compile(CONF.adapter_os_pattern)
        flavor_re = re.compile(CONF.adapter_flavor_pattern)

        adapter_id = None
        os_id = None
        flavor_id = None
        adapter = None

        adapter = resp[0]
        adapter_id = adapter['id']
        for supported_os in adapter['supported_oses']:
            if not os_re or os_re.match(supported_os['name']):
                os_id = supported_os['os_id']
                break

        if 'flavors' in adapter:
            for flavor in adapter['flavors']:
                if not flavor_re or flavor_re.match(flavor['name']):
                    flavor_id = flavor['id']
                    break

        assert(os_id and flavor_id)
        return (adapter_id, os_id, flavor_id)
dataset/ETHPy150Open openstack/compass-core/bin/client.py/CompassClient.get_adapter/original