Service with different ID to Name results in state changes every run
Closed this issue · 1 comments
sigwinch28 commented
Specifying the following:
elasticsearch-consul-service:
consul_service.present:
- name: ElasticSearch
- service_id: elasticsearch
- port: 9200
- script: curl -ILSfsm 1 localhost:9200
- interval: 10s
Results in the following "change" every single highstate:
----------
ID: elasticsearch-consul-service
Function: consul_service.present
Name: ElasticSearch
Result: True
Comment: Service "ElasticSearch" created
Started: 00:36:11.143680
Duration: 5.257 ms
Changes:
----------
ElasticSearch:
Service created
----------
This seems to be because the get_service definition in the consul module checks the passed name
argument against the returned service
key which is in fact the service ID.
Since names aren't guaranteed to be unique, I'd like to recommend checking against service IDs in the first place.
systembell commented
That's a great idea @JoeHazzers, thanks!