@staticmethod
def get_services(roles):
    """Translate role names to init system service names.

        Sample usage:

        >>> from pulp_smash import config
        >>> host = config.PulpHost('example.com', {
        ...     'amqp broker': {'service': 'qpidd'},
        ...     'pulp celerybeat': {},
        ... })
        >>> services = config.PulpSmashConfig.get_services(host.roles)
        >>> services == {'pulp_celerybeat', 'qpidd'}
        True

        :param roles: The ``roles`` attribute of a
            :class:`pulp_smash.config.PulpHost`.
        :returns: A set. The services that back the named roles.
        """
    services = set()
    for role in roles:
        if role == 'amqp broker':
            services.add(roles[role]['service'])
        elif role == 'api':
            services.add(roles[role].get('service', 'httpd'))
        elif role in ('pulp celerybeat', 'pulp resource manager',
            'pulp workers'):
            services.add(role.replace(' ', '_'))
        elif role in ('mongod', 'redis', 'squid'):
            services.add(role)
        else:
            continue
    return services
