From 48c3cb4816306d1c022995f09a8fe8622a65c2cd Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Fri, 18 Jun 2021 14:56:01 -0400 Subject: [PATCH] if the salt-minion service isnt running when the state is rendered, dont try to apply schedule - https://github.com/Security-Onion-Solutions/securityonion/issues/1333 --- salt/patch/os/schedule.sls | 2 +- salt/salt/minion-check.sls | 6 ++++-- salt/schedule.sls | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/salt/patch/os/schedule.sls b/salt/patch/os/schedule.sls index a91e61dfe..a5445f3a9 100644 --- a/salt/patch/os/schedule.sls +++ b/salt/patch/os/schedule.sls @@ -1,4 +1,4 @@ -{% if salt['pillar.get']('patch:os:schedule_name') %} +{% if salt['pillar.get']('patch:os:schedule_name') and salt['service.status']('salt-minion', True) %} {% set patch_os_pillar = salt['pillar.get']('patch:os') %} {% set schedule_name = patch_os_pillar.schedule_name %} {% set splay = patch_os_pillar.get('splay', 300) %} diff --git a/salt/salt/minion-check.sls b/salt/salt/minion-check.sls index e8a0c2639..a9d2e8d8d 100644 --- a/salt/salt/minion-check.sls +++ b/salt/salt/minion-check.sls @@ -1,6 +1,7 @@ include: - salt.minion-state-apply-test - + +{% if salt['service.status']('salt-minion', True) %} state-apply-test: schedule.present: - name: salt-minion-state-apply-test @@ -16,4 +17,5 @@ state-apply-test: cron.present: - identifier: so-salt-minion-check - user: root - - minute: '*/5' \ No newline at end of file + - minute: '*/5' +{% endif %} diff --git a/salt/schedule.sls b/salt/schedule.sls index 12e1cd081..30b5f8608 100644 --- a/salt/schedule.sls +++ b/salt/schedule.sls @@ -1,5 +1,7 @@ +{% if salt['service.status']('salt-minion', True) %} schedule: schedule.present: - function: state.highstate - minutes: 15 - maxrunning: 1 +{% endif %}