fix(saltcheck): replace `map.jinja` references with InSpec conditionals

This commit is contained in:
Imran Iqbal 2019-10-18 14:04:26 +01:00
parent 18585bdc90
commit 7e9e619a37
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
2 changed files with 16 additions and 15 deletions

View File

@ -1,10 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=sls # 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: verify_cron.package:
module_and_function: pkg.version module_and_function: pkg.version
args: args:
- {{ cron.pkg }} - {{ package_name }}
assertion: assertNotEmpty assertion: assertNotEmpty

View File

@ -1,29 +1,27 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=sls # vim: ft=sls
{%- from "cron/saltcheck-tests/map.jinja" import cron with context %} {%- set service_name = 'crond' %}
{%- if grains.os_family in ['Debian', 'Suse'] %}
{%- set service_function = 'disabled' %} {%- set service_name = 'cron' %}
{%- set service_running = 'assertFalse' %} {%- elif grains.os_family in ['Arch'] %}
{%- if 'enabled' not in cron or ( 'enabled' in cron and cron.enabled ) %} {%- set service_name = 'cronie' %}
{%- set service_function = 'enabled' %}
{%- set service_running = 'assertTrue' %}
{%- endif %} {%- endif %}
verify_cron.service_available: verify_cron.service_available:
module_and_function: service.available module_and_function: service.available
args: args:
- {{ cron.service }} - {{ service_name }}
assertion: assertTrue assertion: assertTrue
verify_cron.service_{{ service_function }}: verify_cron.service_enabled:
module_and_function: service.{{ service_function }} module_and_function: service.enabled
args: args:
- {{ cron.service }} - {{ service_name }}
assertion: assertTrue assertion: assertTrue
verify_cron.service_running: verify_cron.service_running:
module_and_function: service.status module_and_function: service.status
args: args:
- {{ cron.service }} - {{ service_name }}
assertion: {{ service_running }} assertion: assertTrue