Adding an ability to override check expectations for httpchk

Change-Id: I7fc7474ccefbb471bf8e031e208eaeb61d9dc92e
diff --git a/README.rst b/README.rst
index 264cd21..ca1650e 100644
--- a/README.rst
+++ b/README.rst
@@ -363,6 +363,39 @@
 Definition above will result in creation of ``/etc/haproxy/ssl/dummy_site``
 directory with files ``1-all.pem`` and ``2-all.pem`` (per binds).
 
+Custom listener with http-check options specified
+
+.. code-block:: yaml
+
+  haproxy:
+    proxy:
+      enabled: true
+      forwardfor:
+        enabled: true
+        except: 127.0.0.1
+        header: X-Forwarded-For
+        if-none: false
+      listen:
+        glance_api:
+          binds:
+          - address: 192.168.2.11
+            port: 9292
+            ssl:
+              enabled: true
+              pem_file: /etc/haproxy/ssl/all.pem
+          http_request:
+          - action: set-header X-Forwarded-Proto https
+          mode: http
+          options:
+          - httpchk GET /
+          - httplog
+          - httpclose
+          servers:
+          - host: 127.0.0.1
+            name: ctl01
+            params: check inter 10s fastinter 2s downinter 3s rise 3 fall 3
+            port: 9292
+
 Custom listener with tcp-check options specified (for Redis cluster with Sentinel)
 
 .. code-block:: yaml
diff --git a/haproxy/files/haproxy.cfg b/haproxy/files/haproxy.cfg
index e423291..ee5b5c6 100644
--- a/haproxy/files/haproxy.cfg
+++ b/haproxy/files/haproxy.cfg
@@ -186,6 +186,9 @@
   {%- for http_response in listen.get('http_response', []) %}
   http-response {{ http_response.action }}{% if http_response.condition is defined %} {{ http_response.condition }}{% endif %}
   {%- endfor %}
+  {%- for http_check in listen.get('http_check', []) %}
+  http-check {{ http_check.action }}
+  {%- endfor %}
   {%- for option in listen.get('options', []) %}
   option {{ option }}
   {%- endfor %}
diff --git a/tests/pillar/single_general_service.sls b/tests/pillar/single_general_service.sls
index ab689e2..7281769 100644
--- a/tests/pillar/single_general_service.sls
+++ b/tests/pillar/single_general_service.sls
@@ -12,6 +12,25 @@
       4: 3
     stats_bind_process: "1 2"
     listen:
+      glance_registry:
+        binds:
+        - address: 192.168.2.11
+          port: 9191
+          ssl:
+            enabled: true
+            pem_file: /etc/haproxy/ssl/all.pem
+        http_request:
+        - action: set-header X-Forwarded-Proto https
+        mode: http
+        options:
+        - httpchk GET /
+        - httplog
+        - httpclose
+        servers:
+        - host: 127.0.0.1
+          name: ctl01
+          params: check inter 10s fastinter 2s downinter 3s rise 3 fall 3
+          port: 9191
       glance_api:
         type: openstack-service
         bind_process: "1 2 3 4"