From 4af4ff59702280b8e6b3979421ac7c98a95159e8 Mon Sep 17 00:00:00 2001
From: alxwr <alxwr@users.noreply.github.com>
Date: Wed, 7 Nov 2018 20:06:30 +0100
Subject: [PATCH] Restart (if needed) before reload (#244)

Some configuration changes only take effect after a restart of the service.
When the module 'apache-reload' is triggered too early, it fails which results
in a false-negative result of the Salt run.
In order to fix that 'apache-restart' and the service definition itself are
put before 'apache-reload'. Reload should always succeed if restart did.
---
 apache/init.sls | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/apache/init.sls b/apache/init.sls
index 92c1d0e..16deadd 100644
--- a/apache/init.sls
+++ b/apache/init.sls
@@ -15,6 +15,9 @@ apache:
   service.running:
     - name: {{ apache.service }}
     - enable: True
+    - require:
+      - module: apache-restart
+      - module: apache-reload
 
 # The following states are inert by default and can be used by other states to
 # trigger a restart or reload as needed.
@@ -22,6 +25,8 @@ apache-reload:
   module.wait:
     - name: service.reload
     - m_name: {{ apache.service }}
+    - require:
+      - module: apache-restart
 
 apache-restart:
   module.wait:
-- 
GitLab