diff --git a/template/config/clean.sls b/template/config/clean.sls index 9e644d36..c213c9fe 100644 --- a/template/config/clean.sls +++ b/template/config/clean.sls @@ -3,10 +3,12 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} {%- set sls_service_clean = tplroot ~ '.service.clean' %} {%- from tplroot ~ "/map.jinja" import template with context %} include: + - {{ sls_fail_if_unsupported }} - {{ sls_service_clean }} template-config-clean-file-absent: diff --git a/template/config/file.sls b/template/config/file.sls index fc07019d..4c6dfb49 100644 --- a/template/config/file.sls +++ b/template/config/file.sls @@ -3,11 +3,13 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} {%- set sls_package_install = tplroot ~ '.package.install' %} {%- from tplroot ~ "/map.jinja" import template with context %} {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} include: + - {{ sls_fail_if_unsupported }} - {{ sls_package_install }} template-config-file-file-managed: 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/clean.sls b/template/package/clean.sls index 8d2660f9..cd50ee42 100644 --- a/template/package/clean.sls +++ b/template/package/clean.sls @@ -3,10 +3,12 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} {%- set sls_config_clean = tplroot ~ '.config.clean' %} {%- from tplroot ~ "/map.jinja" import template with context %} include: + - {{ sls_fail_if_unsupported }} - {{ sls_config_clean }} template-package-clean-pkg-removed: diff --git a/template/package/install.sls b/template/package/install.sls index 78bdb5ea..e5a05a38 100644 --- a/template/package/install.sls +++ b/template/package/install.sls @@ -3,8 +3,12 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} {%- from tplroot ~ "/map.jinja" import template with context %} +include: + - {{ sls_fail_if_unsupported }} + template-package-install-pkg-installed: pkg.installed: - name: {{ template.pkg }} diff --git a/template/service/clean.sls b/template/service/clean.sls index 2074193d..58669d40 100644 --- a/template/service/clean.sls +++ b/template/service/clean.sls @@ -3,8 +3,12 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} {%- from tplroot ~ "/map.jinja" import template with context %} +include: + - {{ sls_fail_if_unsupported }} + template-service-clean-service-dead: service.dead: - name: {{ template.service.name }} diff --git a/template/service/running.sls b/template/service/running.sls index d668f85f..2175cf26 100644 --- a/template/service/running.sls +++ b/template/service/running.sls @@ -3,10 +3,12 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_fail_if_unsupported = tplroot ~ '.unsupported' %} {%- set sls_config_file = tplroot ~ '.config.file' %} {%- from tplroot ~ "/map.jinja" import template with context %} include: + - {{ sls_fail_if_unsupported }} - {{ sls_config_file }} template-service-running-service-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 %}