Browse Source

Re-add map.jinja changes from #36 lost on #36

tags/v0.9.0
Javier Bértoli 6 years ago
parent
commit
788d08811f
3 changed files with 27 additions and 52 deletions
  1. +18
    -50
      logrotate/map.jinja
  2. +2
    -1
      logrotate/osfamilymap.yaml
  3. +7
    -1
      test/integration/default/controls/base.rb

+ 18
- 50
logrotate/map.jinja View File

@@ -2,56 +2,24 @@
# 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 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 {}
%}
{% 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_map = salt['grains.filter_by']({
'Ubuntu': {
'default_config': {
'su': 'root syslog'
},
},
},
grain="os",
merge=os_family_map) or {}
%}
{% do salt['defaults.merge'](default_settings['logrotate'], osfam) %}
{% do salt['defaults.merge'](default_settings['logrotate'], os) %}

{% 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',
)
%}

+ 2
- 1
logrotate/osfamilymap.yaml View File

@@ -6,6 +6,7 @@ Debian:
default_config:
compress: True
RedHat:
pkg: cronie
service: crond
default_config:
dateext: True
@@ -24,4 +25,4 @@ Gentoo:
FreeBSD:
conf_file: /usr/local/etc/logrotate.conf
include_dir: /usr/local/etc/logrotate.d
group: wheel
group: wheel

+ 7
- 1
test/integration/default/controls/base.rb View File

@@ -2,7 +2,13 @@

title 'Test logrotate installation'

describe package('logrotate') do
case os[:name]
when 'redhat', 'centos', 'fedora'
pkg = 'cronie'
else
pkg = 'logrotate'
end
describe package(pkg) do
it { should be_installed }
end


Loading…
Cancel
Save