Browse Source

Merge pull request #176 from FHE3/fix_at_cron_compatibility

This is a fix for issue #174 regarding at and cron system modules. Cu…
pull/178/head
Filip Pytloun 6 years ago
parent
commit
1c358ecd81
No account linked to committer's email address
4 changed files with 40 additions and 28 deletions
  1. +26
    -18
      linux/map.jinja
  2. +5
    -5
      linux/system/at.sls
  3. +5
    -5
      linux/system/cron.sls
  4. +4
    -0
      linux/system/init.sls

+ 26
- 18
linux/map.jinja View File

'logpath': '/var/log/atop', 'logpath': '/var/log/atop',
'outfile': '/var/log/atop/daily.log' 'outfile': '/var/log/atop/daily.log'
}, },
'at': {
'pkgs': [],
'services': []
},
'cron': {
'pkgs': [],
'services': []
},
}, },
'Debian': { 'Debian': {
'pkgs': ['python-apt', 'apt-transport-https', 'libmnl0'], 'pkgs': ['python-apt', 'apt-transport-https', 'libmnl0'],
'logpath': '/var/log/atop', 'logpath': '/var/log/atop',
'outfile': '/var/log/atop/daily.log' 'outfile': '/var/log/atop/daily.log'
}, },
'at': {
'pkgs': ['at'],
'services': ['atd'],
'user': {}
},
'cron': {
'pkgs': ['cron'],
'services': ['cron'],
'user': {}
},
}, },
'RedHat': { 'RedHat': {
'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'], 'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'],
'logpath': '/var/log/atop', 'logpath': '/var/log/atop',
'outfile': '/var/log/atop/daily.log' 'outfile': '/var/log/atop/daily.log'
}, },
'at': {
'pkgs': [],
'services': []
},
'cron': {
'pkgs': [],
'services': []
},
}, },
}, grain='os_family', merge=salt['pillar.get']('linux:system')) %} }, grain='os_family', merge=salt['pillar.get']('linux:system')) %}


{% set at = salt['grains.filter_by']({
'Debian': {
'enabled': false,
'pkgs': ['at'],
'services': ['atd'],
'user': {}
},
}, grain='os_family', merge=salt['pillar.get']('linux:system:at')) %}

{% set cron = salt['grains.filter_by']({
'Debian': {
'enabled': false,
'pkgs': ['cron'],
'services': ['cron'],
'user': {}
},
}, grain='os_family', merge=salt['pillar.get']('linux:system:cron')) %}

{% set banner = salt['grains.filter_by']({ {% set banner = salt['grains.filter_by']({
'BaseDefaults': { 'BaseDefaults': {
'enabled': false, 'enabled': false,

+ 5
- 5
linux/system/at.sls View File

{%- from "linux/map.jinja" import system, at with context %}
{%- from "linux/map.jinja" import system with context %}


{%- if at.get('enabled', false) %}
{%- if system.at.enabled is defined and system.at.enabled %}


at_packages: at_packages:
pkg.installed: pkg.installed:
- names: {{ at.pkgs }}
- names: {{ system.at.pkgs }}


at_services: at_services:
service.running: service.running:
- enable: true - enable: true
- names: {{ at.services }}
- names: {{ system.at.services }}
- require: - require:
- pkg: at_packages - pkg: at_packages
{%- if grains.get('noservices') %} {%- if grains.get('noservices') %}
{%- endif %} {%- endif %}


{%- set allow_users = [] %} {%- set allow_users = [] %}
{%- for user_name, user_params in at.get('user', {}).items() %}
{%- for user_name, user_params in system.at.get('user', {}).items() %}
{%- set user_enabled = user_params.get('enabled', false) and {%- set user_enabled = user_params.get('enabled', false) and
system.get('user', {}).get( system.get('user', {}).get(
user_name, {'enabled': true}).get('enabled', true) %} user_name, {'enabled': true}).get('enabled', true) %}

+ 5
- 5
linux/system/cron.sls View File

{%- from "linux/map.jinja" import system, cron with context %}
{%- from "linux/map.jinja" import system with context %}


{%- if cron.get('enabled', false) %}
{%- if system.cron.enabled is defined and system.cron.enabled %}


cron_packages: cron_packages:
pkg.installed: pkg.installed:
- names: {{ cron.pkgs }}
- names: {{ system.cron.pkgs }}


cron_services: cron_services:
service.running: service.running:
- enable: true - enable: true
- names: {{ cron.services }}
- names: {{ system.cron.services }}
- require: - require:
- pkg: cron_packages - pkg: cron_packages
{%- if grains.get('noservices') %} {%- if grains.get('noservices') %}
{%- endif %} {%- endif %}


{%- set allow_users = [] %} {%- set allow_users = [] %}
{%- for user_name, user_params in cron.get('user', {}).items() %}
{%- for user_name, user_params in system.cron.get('user', {}).items() %}
{%- set user_enabled = user_params.get('enabled', false) and {%- set user_enabled = user_params.get('enabled', false) and
system.get('user', {}).get( system.get('user', {}).get(
user_name, {'enabled': true}).get('enabled', true) %} user_name, {'enabled': true}).get('enabled', true) %}

+ 4
- 0
linux/system/init.sls View File

{%- if system.login_defs is defined %} {%- if system.login_defs is defined %}
- linux.system.login_defs - linux.system.login_defs
{%- endif %} {%- endif %}
{%- if system.at is defined %}
- linux.system.at - linux.system.at
{%- endif %}
{%- if system.cron is defined %}
- linux.system.cron - linux.system.cron
{%- endif %}
{%- if system.repo|length > 0 %} {%- if system.repo|length > 0 %}
- linux.system.repo - linux.system.repo
{%- endif %} {%- endif %}

Loading…
Cancel
Save