Update conditions in logrotate
salt.master pillar may be not set, so import
from map.jinja may fail, so we need to fix conditions
to take values directly from pillars
Change-Id: I46ddc817957d3ce6f47ca2a59f2c00448b2625d3
Related: PROD-29848
diff --git a/salt/meta/logrotate.yml b/salt/meta/logrotate.yml
index 561038a..47a6a09 100644
--- a/salt/meta/logrotate.yml
+++ b/salt/meta/logrotate.yml
@@ -1,19 +1,17 @@
## Default: Weekly rotation with 7 rotations kept
-{%- from "salt/map.jinja" import master, minion with context %}
-
-{%- if master.get('enabled', False) %}
- {%- set log_interval = master.get('logrotate', {}).get('interval', 'weekly') %}
- {%- set log_rotation = master.get('logrotate', {}).get('rotate', 7) %}
-{%- elif minion.get('enabled', False) %}
- {%- set log_interval = minion.get('logrotate', {}).get('interval', 'weekly') %}
- {%- set log_rotation = minion.get('logrotate', {}).get('rotate', 7) %}
+{%- if pillar.salt.get('master', {}).get('enabled', False) or pillar.salt.get('minion', {}).get('enabled', False) %}
+{%- if pillar.salt.get('master', {}).get('enabled', False) %}
+ {%- set log_interval = pillar.salt.master.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = pillar.salt.master.get('logrotate', {}).get('rotate', 7) %}
+{%- elif pillar.salt.get('minion', {}).get('enabled', False) %}
+ {%- set log_interval = pillar.salt.minion.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = pillar.salt.minion.get('logrotate', {}).get('rotate', 7) %}
{%- endif %}
-{%- if master.get('enabled', False) or minion.get('enabled', False) %}
job:
salt-common:
- files:
- {%- if master.get('enabled', False) %}
+ {%- if pillar.salt.get('master', {}).get('enabled', False) %}
- /var/log/salt/master
{%- endif %}
- /var/log/salt/minion