Skip to content

return empty array for GetAll intead of err#1

Closed
johnrengelman wants to merge 1 commit intokelseyhightower:masterfrom
johnrengelman:empty-list
Closed

return empty array for GetAll intead of err#1
johnrengelman wants to merge 1 commit intokelseyhightower:masterfrom
johnrengelman:empty-list

Conversation

@johnrengelman
Copy link

Support template processing where a key may not be available at templating time (i.e. no passing servers for a Consul service health check)

kelseyhightower/confd#102

@kelseyhightower
Copy link
Owner

@johnrengelman This will break things as we want to ensure if no match is found we return an error. Is the idea being we want an empty list in some cases?

@johnrengelman
Copy link
Author

Yes. For example, you have a template for HAProxy that relies on Consul returning the healthy hosts for a service. If there are none, then Consul returns an empty list which would cause an error in confd when the template is processed. But this isn't really an error condition as having no backend servers is a valid state for HAProxy.

@johnrengelman
Copy link
Author

Perhaps a new function that doesn't error? GetList?

@okushchenko
Copy link
Collaborator

Fixed in 32a4556

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants