def _apply_variables(self, value):
        value = value.replace('{service}', self._name)
        if self._group:
            value = value.replace('{group}', self._group)
        variables = self._config.get('variables', {})
        if self._environment in variables:
            variables = variables[self._environment]
        for name in variables:
            key = '{{{0}}}'.format(name)
            if key in value:
                value = value.replace(key, variables[name])

        for unit_name in self._deployed_units:
            _parent, service, _group, _ver = utils.parse_unit_name(unit_name)
            base_service = '{}.service'.format(service)
            if base_service in value:
                LOGGER.debug('Replacing %s with %s in value',
                             base_service, unit_name)
                value = value.replace(base_service, unit_name)
        return value
dataset/ETHPy150Open aweber/houston/houston/controller.py/Controller._apply_variables/original