diff --git a/template/config/init.sls b/template/config/init.sls index 465ddfea..3455390a 100644 --- a/template/config/init.sls +++ b/template/config/init.sls @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- # vim: ft=sls +{%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} + include: + - {{ sls_fail_if_unsupported }} - .file diff --git a/template/init.sls b/template/init.sls index 858a8e6e..a4201b9b 100644 --- a/template/init.sls +++ b/template/init.sls @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- # vim: ft=sls +{%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} + include: + - {{ sls_fail_if_unsupported }} - .package - .config - .service diff --git a/template/osfamilymap.yaml b/template/osfamilymap.yaml index 8309177f..3a95dc4b 100644 --- a/template/osfamilymap.yaml +++ b/template/osfamilymap.yaml @@ -33,8 +33,11 @@ FreeBSD: {} OpenBSD: {} -Solaris: {} +Solaris: + unsupported: 'osfamily: Solaris.' -Windows: {} +Windows: + unsupported: 'osfamily: Windows.' -MacOS: {} +MacOS: + unsupported: 'osfamily: MacOS.' diff --git a/template/osfingermap.yaml b/template/osfingermap.yaml index 60559286..d8726063 100644 --- a/template/osfingermap.yaml +++ b/template/osfingermap.yaml @@ -10,11 +10,15 @@ # the `os_finger` grain. --- # os: Ubuntu +Ubuntu-14.04: + unsupported: 'osfinger: Ubuntu 14.04 (does not use `systemd`).' +Ubuntu-16.04: {} Ubuntu-18.04: config: /etc/template.d/custom-ubuntu-18.04.conf # os: CentOS CentOS-6: - pkg: template-centos-6 - config: /etc/template.d/custom-centos-6.conf -CentOS-7: {} + unsupported: 'osfinger: CentOS 6 (does not use `systemd`).' +CentOS-7: + pkg: template-centos-7 + config: /etc/template.d/custom-centos-7.conf diff --git a/template/osmap.yaml b/template/osmap.yaml index bf58ecf3..84e7c29e 100644 --- a/template/osmap.yaml +++ b/template/osmap.yaml @@ -14,7 +14,8 @@ Ubuntu: pkg: template-ubuntu config: /etc/template.d/custom-ubuntu.conf -Raspbian: {} +Raspbian: + unsupported: 'os: Raspbian (`armhf` architecture).' # os_family: RedHat Fedora: diff --git a/template/package/init.sls b/template/package/init.sls index d3e55181..c2822249 100644 --- a/template/package/init.sls +++ b/template/package/init.sls @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- # vim: ft=sls +{%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} + include: + - {{ sls_fail_if_unsupported }} - .install diff --git a/template/service/init.sls b/template/service/init.sls index 6fe4d1a3..d9ddc664 100644 --- a/template/service/init.sls +++ b/template/service/init.sls @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- # vim: ft=sls +{%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} + include: + - {{ sls_fail_if_unsupported }} - .running diff --git a/template/unsupported.sls b/template/unsupported.sls new file mode 100644 index 00000000..8aa9a15e --- /dev/null +++ b/template/unsupported.sls @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import template with context %} + +{%- if template.unsupported is defined and template.unsupported %} +template-unsupported-test-fail: + test.fail_without_changes: + - name: | + + + ####################################### + # Unsupported minion for this formula # + ####################################### + {{ template.unsupported }} + - failhard: True +{%- endif %}