Преглед на файлове

This is a fix for issue #174 regarding at and cron system modules. Currently this

System modules are enables by default. But they should only be enables if
in pillars defined and supported by os_family.

Support for Redhat os_family systems is missing in at and cron #174
pull/176/head
Nick Metz преди 6 години
родител
ревизия
d2bdab9dc0
променени са 4 файла, в които са добавени 40 реда и са изтрити 28 реда
  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 Целия файл

@@ -26,6 +26,14 @@
'logpath': '/var/log/atop',
'outfile': '/var/log/atop/daily.log'
},
'at': {
'pkgs': [],
'services': []
},
'cron': {
'pkgs': [],
'services': []
},
},
'Debian': {
'pkgs': ['python-apt', 'apt-transport-https', 'libmnl0'],
@@ -54,6 +62,16 @@
'logpath': '/var/log/atop',
'outfile': '/var/log/atop/daily.log'
},
'at': {
'pkgs': ['at'],
'services': ['atd'],
'user': {}
},
'cron': {
'pkgs': ['cron'],
'services': ['cron'],
'user': {}
},
},
'RedHat': {
'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'],
@@ -82,27 +100,17 @@
'logpath': '/var/log/atop',
'outfile': '/var/log/atop/daily.log'
},
'at': {
'pkgs': [],
'services': []
},
'cron': {
'pkgs': [],
'services': []
},
},
}, 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']({
'BaseDefaults': {
'enabled': false,

+ 5
- 5
linux/system/at.sls Целия файл

@@ -1,15 +1,15 @@
{%- 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:
pkg.installed:
- names: {{ at.pkgs }}
- names: {{ system.at.pkgs }}

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

{%- 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
system.get('user', {}).get(
user_name, {'enabled': true}).get('enabled', true) %}

+ 5
- 5
linux/system/cron.sls Целия файл

@@ -1,15 +1,15 @@
{%- 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:
pkg.installed:
- names: {{ cron.pkgs }}
- names: {{ system.cron.pkgs }}

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

{%- 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
system.get('user', {}).get(
user_name, {'enabled': true}).get('enabled', true) %}

+ 4
- 0
linux/system/init.sls Целия файл

@@ -7,8 +7,12 @@ include:
{%- if system.login_defs is defined %}
- linux.system.login_defs
{%- endif %}
{%- if system.at is defined %}
- linux.system.at
{%- endif %}
{%- if system.cron is defined %}
- linux.system.cron
{%- endif %}
{%- if system.repo|length > 0 %}
- linux.system.repo
{%- endif %}

Loading…
Отказ
Запис