{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/consul-template/issues/212","labels_url":"https://api.github.com/repos/hashicorp/consul-template/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/consul-template/issues/212/comments","events_url":"https://api.github.com/repos/hashicorp/consul-template/issues/212/events","html_url":"https://github.com/hashicorp/consul-template/pull/212","id":59998839,"number":212,"title":"Fix service filtering","user":{"login":"sethvargo","id":408570,"avatar_url":"https://avatars.githubusercontent.com/u/408570?v=3","gravatar_id":"","url":"https://api.github.com/users/sethvargo","html_url":"https://github.com/sethvargo","followers_url":"https://api.github.com/users/sethvargo/followers","following_url":"https://api.github.com/users/sethvargo/following{/other_user}","gists_url":"https://api.github.com/users/sethvargo/gists{/gist_id}","starred_url":"https://api.github.com/users/sethvargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethvargo/subscriptions","organizations_url":"https://api.github.com/users/sethvargo/orgs","repos_url":"https://api.github.com/users/sethvargo/repos","events_url":"https://api.github.com/users/sethvargo/events{/privacy}","received_events_url":"https://api.github.com/users/sethvargo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-05T19:02:15Z","updated_at":"2015-03-06T17:13:34Z","closed_at":"2015-03-05T22:30:15Z","pull_request":{"url":"https://api.github.com/repos/hashicorp/consul-template/pulls/212","html_url":"https://github.com/hashicorp/consul-template/pull/212","diff_url":"https://github.com/hashicorp/consul-template/pull/212.diff","patch_url":"https://github.com/hashicorp/consul-template/pull/212.patch"},"body":"This fixes a pretty critical bug in how we filter services, specifically around how we handle \"any\" vs \"passing\" vs \"(other things)\".\r\n\r\n\"any\" is a special case in that it cannot and should not be specified with other status filters. In the past, it was permitted to do this:\r\n\r\n```liquid\r\n{{ range services \"nginx\" \"any, passing\" }}{{ end }}\r\n```\r\n\r\nThis led to user confusion. Users thought this meant \"give me any service that is passing\", but it really means \"give me a service that has any status or services that are passing\", but since passing services are a subset of any service it was really \"give me all services regardless of their status\". This was especially confusing for new users and the documentation was a bit unclear. Consul Template now returns an error when you specify additional filters using \"any\":\r\n\r\n```text\r\n* service filter: cannot specify extra keys when using \"any\"\r\n```\r\n\r\nHopefully this will help eliminate some of the confusion around the behavior of \"any\". I have additionally updated the documentation.\r\n\r\n\"passing\" is also a special case that was improperly handled before. \"passing\" actually has a dual meaning - when we query Consul, we have the option to return only passing services. When we filter services on Consul Template's end, we also have the option to filter _only_ passing services. Furthermore, there is a fundamental difference between:\r\n\r\n```liquid\r\n{{ range services \"nginx\" \"passing\" }}\r\n```\r\n\r\nand\r\n\r\n```liquid\r\n{{ range services \"nginx\" \"passing, unknown\" }}\r\n```\r\n\r\nThe former says \"give me all nginx services which have all checks passing\". The latter says \"give me all nginx services which has at least one check that is passing or at least one check that is unknown\". Previously, we did not differentiate between these two cases. This PR changes Consul Template to handle \"passing\" vs \"passing, (other)\" differently.\r\n\r\nFinally, this PR adds an additional check to the status filter parsing to ignore empty statuses, for example:\r\n\r\n```liquid\r\n{{ range services \"nginx\" \"unknown,   , critical\" }}\r\n```\r\n\r\nThis is useful if the user is building the filter from the result of a subquery where they are dynamically building the list of acceptable status filters.\r\n\r\n- Fixes https://github.com/hashicorp/consul-template/issues/210"},"comment":{"url":"https://api.github.com/repos/hashicorp/consul-template/issues/comments/77596482","html_url":"https://github.com/hashicorp/consul-template/pull/212#issuecomment-77596482","issue_url":"https://api.github.com/repos/hashicorp/consul-template/issues/212","id":77596482,"user":{"login":"tgwizard","id":660706,"avatar_url":"https://avatars.githubusercontent.com/u/660706?v=3","gravatar_id":"","url":"https://api.github.com/users/tgwizard","html_url":"https://github.com/tgwizard","followers_url":"https://api.github.com/users/tgwizard/followers","following_url":"https://api.github.com/users/tgwizard/following{/other_user}","gists_url":"https://api.github.com/users/tgwizard/gists{/gist_id}","starred_url":"https://api.github.com/users/tgwizard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgwizard/subscriptions","organizations_url":"https://api.github.com/users/tgwizard/orgs","repos_url":"https://api.github.com/users/tgwizard/repos","events_url":"https://api.github.com/users/tgwizard/events{/privacy}","received_events_url":"https://api.github.com/users/tgwizard/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T17:13:34Z","updated_at":"2015-03-06T17:13:34Z","body":"Ah, with that part in the README I think it is clear enough."}}