Merge pull request #479 from hashicorp/r-consul-check

Using the service name in the service id so that it's unique
This commit is contained in:
Diptanu Choudhury 2015-11-20 15:33:57 -08:00
commit f4efcf9678

View file

@ -157,7 +157,7 @@ func (c *ConsulClient) SyncWithConsul() {
func (c *ConsulClient) registerService(service *structs.Service, task *structs.Task, allocID string) error {
var mErr multierror.Error
service.Id = fmt.Sprintf("%s-%s", allocID, task.Name)
service.Id = fmt.Sprintf("%s-%s", allocID, service.Name)
host, port := c.findPortAndHostForLabel(service.PortLabel, task)
if host == "" || port == 0 {
return fmt.Errorf("consul: The port:%s marked for registration of service: %s couldn't be found", service.PortLabel, service.Name)