From 3afd3d95995e0f0934069b139c55f5a951340efd Mon Sep 17 00:00:00 2001
From: Alain Takoudjou <alain.takoudjou@nexedi.com>
Date: Fri, 27 May 2016 12:26:22 +0200
Subject: [PATCH] monitor stack: do not regenerate httpd password if password
 file exists

---
 stack/monitor/instance-monitor.cfg.jinja2.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/stack/monitor/instance-monitor.cfg.jinja2.in b/stack/monitor/instance-monitor.cfg.jinja2.in
index 5de39730d9..0fd49f890f 100644
--- a/stack/monitor/instance-monitor.cfg.jinja2.in
+++ b/stack/monitor/instance-monitor.cfg.jinja2.in
@@ -221,7 +221,8 @@ update-command = ${:command}
 recipe = plone.recipe.command
 stop-on-error = true
 htpasswd-path = ${monitor-directory:etc}/monitor-htpasswd
-command = {{ apache_location }}/bin/htpasswd -cb ${:htpasswd-path} ${:user} ${:password}
+command = if [ ! -f "${:htpasswd-path}" ]; then {{ apache_location }}/bin/htpasswd -cb ${:htpasswd-path} ${:user} ${:password}; fi
+update-command = ${:command}
 user = ${monitor-instance-parameter:username}
 password = ${monitor-instance-parameter:password}
 
-- 
2.30.9