Merge "Add host label to telegraf targets"
diff --git a/.kitchen.travis.yml b/.kitchen.travis.yml
deleted file mode 100644
index f847543..0000000
--- a/.kitchen.travis.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-suites:
-
-  - name: <%= ENV['SUITE'] %>
-    provisioner:
-      pillars-from-files:
-        neutron.sls: tests/pillar/<%= ENV['SUITE'] %>.sls
diff --git a/.kitchen.yml b/.kitchen.yml
index 9014285..d200f1f 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -38,9 +38,9 @@
 
 
 platforms:
-  - name: <%=ENV['PLATFORM'] || 'ubuntu-xenial'%>
+  - name: <%=ENV['PLATFORM'] ||  'saltstack-ubuntu-xenial-salt-stable' %>
     driver_config:
-      image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
+      image: <%=ENV['PLATFORM'] || 'epcim/salt-formulas:saltstack-ubuntu-xenial-salt-stable'%>
       platform: ubuntu
 
 suites:
diff --git a/.travis.yml b/.travis.yml
index 08855d5..9e5942f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,15 +17,17 @@
   - bundle install
 
 env:
-  - PLATFORM=trevorj/salty-whales:trusty SUITE=telegraf_agent
-  - PLATFORM=trevorj/salty-whales:xenial SUITE=telegraf_agent
+  - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 SUITE=telegraf-agent
+  - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 SUITE=telegraf-agent
+  # - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-bionic-salt-2017.7 SUITE=telegraf-agent
 
 before_script:
   - set -o pipefail
   - make test | tail
 
 script:
-  - KITCHEN_LOCAL_YAML=.kitchen.travis.yml bundle exec kitchen test -t tests/integration
+  - test ! -e .kitchen.yml || bundle exec kitchen converge ${SUITE} || true
+  - test ! -e .kitchen.yml || bundle exec kitchen verify ${SUITE} -t tests/integration
 
 notifications:
   webhooks:
diff --git a/Makefile b/Makefile
index 1043fbe..d166862 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,7 @@
 
 all:
 	@echo "make install - Install into DESTDIR"
+	@echo "make lint    - Run lint tests"
 	@echo "make test    - Run tests"
 	@echo "make kitchen - Run Kitchen CI tests (create, converge, verify)"
 	@echo "make clean   - Cleanup after tests run"
@@ -45,6 +46,9 @@
 	[ -d $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME) ] || mkdir -p $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME)
 	cp -a metadata/service/* $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME)
 
+lint:
+	[ ! -d tests ] || (cd tests; ./run_tests.sh lint)
+
 test:
 	[ ! -d tests ] || (cd tests; ./run_tests.sh)
 
@@ -65,7 +69,7 @@
 	[ ! -f debian/changelog ] || dch -v $(VERSION_MAJOR).$(NEW_MINOR_VERSION) -m --force-distribution -D `dpkg-parsechangelog -S Distribution` "New version"
 	make genchangelog-$(VERSION_MAJOR).$(NEW_MINOR_VERSION)
 	(git add -u; git commit -m "Version $(VERSION_MAJOR).$(NEW_MINOR_VERSION)")
-	git tag -s -m $(NEW_MAJOR_VERSION) $(VERSION_MAJOR).$(NEW_MINOR_VERSION)
+	git tag -s -m $(VERSION_MAJOR).$(NEW_MINOR_VERSION) $(VERSION_MAJOR).$(NEW_MINOR_VERSION)
 
 check-changes:
 	@git log --pretty=oneline --decorate $(VERSION)..HEAD | grep -Eqc '.*' || (echo "No new changes since version $(VERSION)"; exit 1)
diff --git a/debian/control b/debian/control
index 692bd18..a95454d 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,6 @@
 
 Package: salt-formula-telegraf
 Architecture: all
-Depends: ${misc:Depends}, salt-master, reclass
+Depends: ${misc:Depends}
 Description: telegraf Salt formula
  Install and configure telegraf monitoring
diff --git a/telegraf/files/input/_filters.conf b/telegraf/files/input/_filters.conf
index ce01d50..4ddeceb 100644
--- a/telegraf/files/input/_filters.conf
+++ b/telegraf/files/input/_filters.conf
@@ -1,4 +1,4 @@
-{%- for filter in ('namepass', 'namedrop', 'fieldpass', 'fielddrop', 'tagpass', 'tagdrop') %}
+{%- for filter in ('namepass', 'namedrop', 'fieldpass', 'fielddrop') %}
 {%- if values.get(filter) is not none %}
 {{ filter }} = {%- if values[filter] is string %}[ "{{ values[filter] }}" ]{%- else %}{{ values[filter]|json }}{%- endif %}
 {%- endif %}
diff --git a/telegraf/files/input/_tags.conf b/telegraf/files/input/_tags.conf
index 3c16a02..ae97e17 100644
--- a/telegraf/files/input/_tags.conf
+++ b/telegraf/files/input/_tags.conf
@@ -10,3 +10,15 @@
     {{ tag_name }} = "{{ tag_value }}"
   {%- endfor %}
 {%- endif %}
+{%- if values.tagpass is mapping %}
+  [inputs.{{name}}.tagpass]
+  {%- for tag_name, tag_value in values.tagpass.iteritems() %}
+    {{ tag_name }} = {%- if tag_value is string %}[ "{{ tag_value }}" ]{%- else %}{{ tag_value|json }}{%- endif %}
+  {%- endfor %}
+{%- endif %}
+{%- if values.tagdrop is mapping %}
+  [inputs.{{name}}.tagdrop]
+  {%- for tag_name, tag_value in values.tagdrop.iteritems() %}
+    {{ tag_name }} = {%- if tag_value is string %}[ "{{ tag_value }}" ]{%- else %}{{ tag_value|json }}{%- endif %}
+  {%- endfor %}
+{%- endif %}
diff --git a/telegraf/files/input/docker.conf b/telegraf/files/input/docker.conf
index d4b8003..80abd1c 100644
--- a/telegraf/files/input/docker.conf
+++ b/telegraf/files/input/docker.conf
@@ -12,4 +12,13 @@
 {%- if values.total is defined %}
   total = {{ values.total | lower }}
 {%- endif %}
+{%- if values.gather_services is defined %}
+  gather_services = {{ values.gather_services | lower }}
+{%- endif %}
+{%- if values.container_name_include is defined %}
+  container_name_include = {{ values.container_name_include|json }}
+{%- endif %}
+{%- if values.container_name_exclude is defined %}
+  container_name_exclude = {{ values.container_name_exclude|json }}
+{%- endif %}
 {%- include 'telegraf/files/input/_filters.conf' %}