Added Kitchen tests and Travis
diff --git a/.kitchen.yml b/.kitchen.yml
new file mode 100644
index 0000000..f46053f
--- /dev/null
+++ b/.kitchen.yml
@@ -0,0 +1,63 @@
+---
+driver:
+ name: docker
+ hostname: haproxy.ci.local
+ use_sudo: false
+
+provisioner:
+ name: salt_solo
+ salt_install: bootstrap
+ salt_bootstrap_url: https://bootstrap.saltstack.com
+ salt_version: latest
+ require_chef: false
+ log_level: error
+ formula: haproxy
+ grains:
+ noservices: True
+ state_top:
+ base:
+ "*":
+ - haproxy
+ pillars:
+ top.sls:
+ base:
+ "*":
+ - haproxy
+
+verifier:
+ name: inspec
+ sudo: true
+
+platforms:
+ - name: <%=ENV['PLATFORM'] || 'ubuntu-xenial'%>
+ driver_config:
+ image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
+ platform: ubuntu
+
+suites:
+
+ - name: admin
+ provisioner:
+ pillars-from-files:
+ haproxy.sls: tests/pillar/admin.sls
+
+ - name: single_contrail
+ provisioner:
+ pillars-from-files:
+ haproxy.sls: tests/pillar/single_contrail.sls
+
+ - name: single_general_service
+ provisioner:
+ pillars-from-files:
+ haproxy.sls: tests/pillar/single_general_service.sls
+
+ - name: single_openstack_service
+ provisioner:
+ pillars-from-files:
+ haproxy.sls: tests/pillar/single_openstack_service.sls
+
+ - name: stats
+ provisioner:
+ pillars-from-files:
+ haproxy.sls: tests/pillar/stats.sls
+# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..4c8e84e
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
+sudo: required
+services:
+ - docker
+
+install:
+ - pip install PyYAML
+ - pip install virtualenv
+ - |
+ test -e Gemfile || cat <<EOF > Gemfile
+ source 'https://rubygems.org'
+ gem 'rake'
+ gem 'test-kitchen'
+ gem 'kitchen-docker'
+ gem 'kitchen-inspec'
+ gem 'inspec'
+ gem 'kitchen-salt', :git => 'https://github.com/epcim/kitchen-salt.git', :branch => 'dependencis-pkg-repo2'
+ #Waiting for PR#78
+ #gem 'kitchen-salt', '>=0.2.25'
+ - bundle install
+
+env:
+ - PLATFORM=trevorj/salty-whales:trusty
+ - PLATFORM=trevorj/salty-whales:xenial
+
+before_script:
+ - make test | tail
+
+script:
+ - test ! -e .kitchen.yml || bundle exec kitchen test -t tests/integration
diff --git a/haproxy/proxy.sls b/haproxy/proxy.sls
index ac90a42..d5e65cd 100644
--- a/haproxy/proxy.sls
+++ b/haproxy/proxy.sls
@@ -27,10 +27,16 @@
- require:
- pkg: haproxy_packages
+{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
+
net.ipv4.ip_nonlocal_bind:
sysctl.present:
- value: 1
+{% endif %}
+
+{% if not grains.get('noservices', False) %}
+
haproxy_service:
service.running:
- name: {{ proxy.service }}
@@ -39,6 +45,8 @@
- file: /etc/haproxy/haproxy.cfg
- file: /etc/default/haproxy
+{% endif %}
+
{%- for listen_name, listen in proxy.get('listen', {}).iteritems() %}
{%- if listen.get('enabled', True) %}
{%- for bind in listen.binds %}
@@ -59,8 +67,10 @@
chain: {{ bind.ssl.get('chain', '')|yaml }}
- require:
- file: haproxy_ssl
+ {% if not grains.get('noservices', False) %}
- watch_in:
- service: haproxy_service
+ {% endif %}
{%- endif %}
{%- endfor %}
diff --git a/metadata.yml b/metadata.yml
index 21781fb..48c699e 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,3 +1,3 @@
name: "haproxy"
version: "0.2"
-source: "https://github.com/tcpcloud/salt-formula-haproxy"
+source: "https://github.com/salt-formulas/salt-formula-haproxy"