Make sure dependencies are installed if required, fix teststags/v0.9.0
@@ -0,0 +1,103 @@ | |||
# Byte-compiled / optimized / DLL files | |||
__pycache__/ | |||
*.py[cod] | |||
*$py.class | |||
# C extensions | |||
*.so | |||
# Distribution / packaging | |||
.Python | |||
env/ | |||
build/ | |||
develop-eggs/ | |||
dist/ | |||
downloads/ | |||
eggs/ | |||
.eggs/ | |||
lib/ | |||
lib64/ | |||
parts/ | |||
sdist/ | |||
var/ | |||
wheels/ | |||
*.egg-info/ | |||
.installed.cfg | |||
*.egg | |||
# PyInstaller | |||
# Usually these files are written by a python script from a packager | |||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | |||
*.manifest | |||
*.spec | |||
# Installer logs | |||
pip-log.txt | |||
pip-delete-this-directory.txt | |||
# Unit test / coverage reports | |||
htmlcov/ | |||
.tox/ | |||
.coverage | |||
.coverage.* | |||
.cache | |||
nosetests.xml | |||
coverage.xml | |||
*.cover | |||
.hypothesis/ | |||
.kitchen | |||
.kitchen.local.yml | |||
# Translations | |||
*.mo | |||
*.pot | |||
# Django stuff: | |||
*.log | |||
local_settings.py | |||
# Flask stuff: | |||
instance/ | |||
.webassets-cache | |||
# Scrapy stuff: | |||
.scrapy | |||
# Sphinx documentation | |||
docs/_build/ | |||
# PyBuilder | |||
target/ | |||
# Jupyter Notebook | |||
.ipynb_checkpoints | |||
# pyenv | |||
.python-version | |||
# celery beat schedule file | |||
celerybeat-schedule | |||
# SageMath parsed files | |||
*.sage.py | |||
# dotenv | |||
.env | |||
# virtualenv | |||
.venv | |||
venv/ | |||
ENV/ | |||
# Spyder project settings | |||
.spyderproject | |||
.spyproject | |||
# Rope project settings | |||
.ropeproject | |||
# mkdocs documentation | |||
/site | |||
# mypy | |||
.mypy_cache/ |
@@ -8,4 +8,13 @@ services: | |||
before_install: | |||
- bundle install | |||
script: bundle exec kitchen verify | |||
env: | |||
matrix: | |||
- INSTANCE: default-debian-9 | |||
- INSTANCE: default-ubuntu-1804 | |||
- INSTANCE: default-fedora-27 | |||
- INSTANCE: default-centos-7 | |||
script: | |||
- bundle exec kitchen verify ${INSTANCE} | |||
@@ -3,6 +3,7 @@ | |||
{% from "logrotate/map.jinja" import logrotate with context %} | |||
{% set pkgs = [logrotate.pkg] if logrotate.pkg is string else logrotate.pkg %} | |||
logrotate-pkg: | |||
pkg.installed: | |||
- name: {{ logrotate.pkg }} | |||
- pkgs: {{ pkgs }} |
@@ -2,23 +2,56 @@ | |||
# vim: ft=jinja | |||
{% import_yaml 'logrotate/defaults.yaml' as default_settings %} | |||
{% import_yaml "logrotate/osfamilymap.yaml" as os_family_map %} | |||
{% import_yaml "logrotate/osmap.yaml" as os_map %} | |||
{% set osfam = salt['grains.filter_by']( | |||
os_family_map, | |||
grain='os_family', | |||
) or {} %} | |||
{% set os = salt['grains.filter_by']( | |||
os_map, | |||
grain='os', | |||
) or {} %} | |||
{% set os_family_map = salt['grains.filter_by']({ | |||
'Arch': { | |||
'service': 'logrotate.timer', | |||
'default_config': { | |||
'tabooext': '+ .pacorig .pacnew .pacsave', | |||
}, | |||
}, | |||
'Debian': { | |||
'default_config': { | |||
'compress': True, | |||
}, | |||
}, | |||
'RedHat': { | |||
'pkg': [ | |||
'logrotate', | |||
'cronie' | |||
], | |||
'service': 'crond', | |||
'default_config': { | |||
'dateext': True, | |||
}, | |||
}, | |||
'Suse': { | |||
'login_records_jobs': False, | |||
'default_config': { | |||
'dateext': True, | |||
'compresscmd': '/usr/bin/xz', | |||
'uncompresscmd': '/usr/bin/xzdec', | |||
}, | |||
}, | |||
}, | |||
grain="os_family", | |||
merge=salt['pillar.get']('logrotate:lookup')) or {} | |||
%} | |||
{% do salt['defaults.merge'](default_settings['logrotate'], osfam) %} | |||
{% do salt['defaults.merge'](default_settings['logrotate'], os) %} | |||
{% set os_map = salt['grains.filter_by']({ | |||
'Ubuntu': { | |||
'default_config': { | |||
'su': 'root syslog' | |||
}, | |||
}, | |||
}, | |||
grain="os", | |||
merge=os_family_map) or {} | |||
%} | |||
{% set logrotate = salt['pillar.get']( | |||
'logrotate:lookup', | |||
default=default_settings['logrotate'], | |||
merge=True, | |||
) %} | |||
{% set logrotate = salt['grains.filter_by']( | |||
default_settings, | |||
merge=os_map, | |||
base='logrotate', | |||
) | |||
%} |
@@ -20,7 +20,14 @@ describe file('/etc/logrotate.d') do | |||
its('mode') { should cmp '0755' } | |||
end | |||
describe service('cron') do | |||
case os[:name] | |||
when 'redhat', 'centos', 'fedora' | |||
service = 'crond' | |||
else | |||
service = 'cron' | |||
end | |||
describe service(service) do | |||
it { should be_installed } | |||
it { should be_enabled } | |||
it { should be_running } |