1
0
Fork 0
mirror of synced 2024-12-21 21:51:09 -05:00

Merge pull request #55 from netmanagers/master

Fix duplicated entries for login jobs in Debian 10
This commit is contained in:
Imran Iqbal 2020-06-29 17:49:30 +01:00 committed by GitHub
commit b6096f95a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 8 deletions

View file

@ -1,21 +1,29 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=jinja # vim: ft=jinja
{%- import_yaml "logrotate/defaults.yaml" as default_settings %} {#- Get the `tplroot` from `tpldir` #}
{%- import_yaml "logrotate/osfamilymap.yaml" as osfamilymap %} {%- set tplroot = tpldir.split('/')[0] %}
{%- import_yaml "logrotate/osmap.yaml" as osmap %} {#- Start imports as #}
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
{#- Retrieve the config dict only once #} {#- Retrieve the config dict only once #}
{%- set _config = salt['config.get']('logrotate', default={}) %} {%- set _config = salt['config.get'](tplroot, default={}) %}
{%- set defaults = salt['grains.filter_by']( {%- set defaults = salt['grains.filter_by'](
default_settings, default_settings,
default='logrotate', default=tplroot,
merge=salt['grains.filter_by']( merge=salt['grains.filter_by'](
osfamilymap, osfamilymap,
grain='os_family', grain='os_family',
merge=salt['grains.filter_by']( merge=salt['grains.filter_by'](
osmap, osmap,
grain='os', grain='os',
merge=salt['grains.filter_by'](
osfingermap,
grain='osfinger',
merge=salt['grains.filter_by']( merge=salt['grains.filter_by'](
_config, _config,
default='lookup' default='lookup'
@ -23,6 +31,21 @@
) )
) )
) )
)
%} %}
{%- set logrotate = defaults %} {%- set config = salt['grains.filter_by'](
{'defaults': defaults},
default='defaults',
merge=_config
)
%}
{#- Change **logrotate** to match with your formula's name and then remove this line #}
{%- set logrotate = config %}
{#- Post-processing for specific non-YAML customisations #}
{%- if grains.os == 'MacOS' %}
{%- set macos_group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
{%- do logrotate.update({'rootgroup': macos_group}) %}
{%- endif %}

View file

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['osfinger'] based logic.
# You just need to add the key:values for an `osfinger` that differ
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml` + `osmap.yaml`.
# Only add an `osfinger` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `os_finger` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osfingermap: {}
---
# os: Debian
Debian-10:
login_records_jobs: false