From 7e9e619a379b869d270458a99a6f9b04c3b2785d Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Fri, 18 Oct 2019 14:04:26 +0100 Subject: [PATCH] fix(saltcheck): replace `map.jinja` references with InSpec conditionals --- cron/saltcheck-tests/package.tst | 7 +++++-- cron/saltcheck-tests/service.tst | 24 +++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cron/saltcheck-tests/package.tst b/cron/saltcheck-tests/package.tst index cc8ffb5..5ea2cd0 100644 --- a/cron/saltcheck-tests/package.tst +++ b/cron/saltcheck-tests/package.tst @@ -1,10 +1,13 @@ # -*- coding: utf-8 -*- # vim: ft=sls -{%- from "cron/saltcheck-tests/map.jinja" import cron with context %} +{%- set package_name = 'cronie' %} +{%- if grains.os_family in ['Debian'] %} +{%- set package_name = 'cron' %} +{%- endif %} verify_cron.package: module_and_function: pkg.version args: - - {{ cron.pkg }} + - {{ package_name }} assertion: assertNotEmpty diff --git a/cron/saltcheck-tests/service.tst b/cron/saltcheck-tests/service.tst index d2cfe1a..cb971fd 100644 --- a/cron/saltcheck-tests/service.tst +++ b/cron/saltcheck-tests/service.tst @@ -1,29 +1,27 @@ # -*- coding: utf-8 -*- # vim: ft=sls -{%- from "cron/saltcheck-tests/map.jinja" import cron with context %} - -{%- set service_function = 'disabled' %} -{%- set service_running = 'assertFalse' %} -{%- if 'enabled' not in cron or ( 'enabled' in cron and cron.enabled ) %} -{%- set service_function = 'enabled' %} -{%- set service_running = 'assertTrue' %} +{%- set service_name = 'crond' %} +{%- if grains.os_family in ['Debian', 'Suse'] %} +{%- set service_name = 'cron' %} +{%- elif grains.os_family in ['Arch'] %} +{%- set service_name = 'cronie' %} {%- endif %} verify_cron.service_available: module_and_function: service.available args: - - {{ cron.service }} + - {{ service_name }} assertion: assertTrue -verify_cron.service_{{ service_function }}: - module_and_function: service.{{ service_function }} +verify_cron.service_enabled: + module_and_function: service.enabled args: - - {{ cron.service }} + - {{ service_name }} assertion: assertTrue verify_cron.service_running: module_and_function: service.status args: - - {{ cron.service }} - assertion: {{ service_running }} + - {{ service_name }} + assertion: assertTrue