Get the Remote for the host where a particular role runs. :param cluster: name of the cluster the service is part of :param service_type: e.g. 'mds', 'osd', 'client' :param service_id: The third part of a role, e.g. '0' for the role 'ceph.client.0' :retur
(ctx, cluster, service_type, service_id)
| 1 | from teuthology import misc |
| 2 | |
| 3 | def get_remote(ctx, cluster, service_type, service_id): |
| 4 | """ |
| 5 | Get the Remote for the host where a particular role runs. |
| 6 | |
| 7 | :param cluster: name of the cluster the service is part of |
| 8 | :param service_type: e.g. 'mds', 'osd', 'client' |
| 9 | :param service_id: The third part of a role, e.g. '0' for |
| 10 | the role 'ceph.client.0' |
| 11 | :return: a Remote instance for the host where the |
| 12 | requested role is placed |
| 13 | """ |
| 14 | def _is_instance(role): |
| 15 | role_tuple = misc.split_role(role) |
| 16 | return role_tuple == (cluster, service_type, str(service_id)) |
| 17 | try: |
| 18 | (remote,) = ctx.cluster.only(_is_instance).remotes.keys() |
| 19 | except ValueError: |
| 20 | raise KeyError("Service {0}.{1}.{2} not found".format(cluster, |
| 21 | service_type, |
| 22 | service_id)) |
| 23 | return remote |
| 24 | |
| 25 | def get_remote_for_role(ctx, role): |
| 26 | return get_remote(ctx, *misc.split_role(role)) |
no test coverage detected