forked from dseira/cron-formula
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(saltcheck): replace
map.jinja
references with InSpec conditionals
- Loading branch information
Showing
2 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |