Allow a client to unsubscribe to channel

This patch allows a client to unsubscribe to a channel. It is used by
example by collectd where we can have different checks. In StackLight we
have a remote collectd that is running and also a collectd daemon. So
there is two collectd processes. By default we subscribe to all channel
according to our roles. But we don't want to subscribe to
collectd.client, only to collectd.remote_client.

Change-Id: I1a6d42abd93b6288740832cfc07fc08ae0559f12
diff --git a/README.rst b/README.rst
index a0fd8f9..10c8d45 100644
--- a/README.rst
+++ b/README.rst
@@ -98,6 +98,24 @@
           local_linux_storage_swap_usage:
             enabled: False
 
+Sensu Client with subscriptions explicitly disabled
+
+.. code-block:: yaml
+
+    sensu:
+      client:
+        enabled: true
+        message_queue:
+          engine: rabbitmq
+          host: rabbitmq
+          port: 5672
+          user: monitor
+          password: pwd
+          virtual_host: '/monitor'
+        unsubscribe:
+          - collectd.client
+          - git.client
+
 Sensu Client with community plugins
 
 .. code-block:: yaml
diff --git a/sensu/files/client.json b/sensu/files/client.json
index f2c10be..78bdf98 100644
--- a/sensu/files/client.json
+++ b/sensu/files/client.json
@@ -1,6 +1,9 @@
 {%- from "linux/map.jinja" import system with context -%}
 {%- from "linux/map.jinja" import network with context -%}
 {%- from "sensu/map.jinja" import client with context -%}
+
+{%- set unsubscribed = client.get('unsubscribe', []) -%}
+
 {
   "client": {
     {%- if client.get('use_shortname', False) %}
@@ -60,8 +63,10 @@
       "handler": "default"
     },
     "subscriptions": [
-      {% for key in grains.roles %}
+      {%- for key in grains.roles %}
+      {%- if key not in unsubscribed %}
       "local-{{ key|replace('.', '-') }}",
+      {%- endif %}
       {%- endfor %}
       {%- if pillar.sensu.server is defined %}
       "remote-internet",
@@ -79,4 +84,4 @@
       "local-common"
     ]
   }
-}
\ No newline at end of file
+}