From be66570a0b0baa8b24b2fa46127e63ae28aa39e9 Mon Sep 17 00:00:00 2001 From: N Date: Sat, 28 Mar 2020 17:55:04 +0000 Subject: [PATCH] feat(os): graceful fail for unsupported os --- docs/README.rst | 2 +- sysstat/clean.sls | 11 +++++++++++ sysstat/init.sls | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/README.rst b/docs/README.rst index 0a8a3fd..c1672cd 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -14,7 +14,7 @@ sysstat-formula :scale: 100% :target: https://github.com/semantic-release/semantic-release -Formula to install sysstat/sar and configure it. +Formula to install sysstat/sar and configure it on GNU/Linux. .. contents:: **Table of Contents** diff --git a/sysstat/clean.sls b/sysstat/clean.sls index 21ba697..452d270 100644 --- a/sysstat/clean.sls +++ b/sysstat/clean.sls @@ -1,8 +1,19 @@ # -*- coding: utf-8 -*- # vim: ft=sls + {%- if grains.os_family not in ('FreeBSD', 'Windows', 'MacOS',) %} + include: - .service.clean - .config.clean - .package.clean - .source.clean + + {%- else %} + +sysstat-not-available-to-clean: + test.show_notification: + - text: | + The sysstat package is unavailable on {{ salt['grains.get']('osfinger', grains.os_family) }} + + {%- endif %} diff --git a/sysstat/init.sls b/sysstat/init.sls index 798fb3a..ea0ba48 100644 --- a/sysstat/init.sls +++ b/sysstat/init.sls @@ -5,7 +5,18 @@ {%- set tplroot = tpldir.split('/')[0] %} {%- from tplroot ~ "/map.jinja" import sysstat with context %} + {%- if grains.os_family not in ('FreeBSD', 'Windows', 'MacOS',) %} + include: - {{ '.source' if sysstat.pkg.use_upstream_source else '.package' }} - .config - .service + + {%- else %} + +sysstat-not-available-to-install: + test.show_notification: + - text: | + The sysstat package is unavailable on {{ salt['grains.get']('osfinger', grains.os_family) }} + + {%- endif %}