From 4ed198851f49200107708970e2aa1c1f15d0279e Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Fri, 25 Nov 2016 17:49:10 -0200 Subject: [PATCH] Update prepare-config script - Reduce verbosity - Only set permissions of dynamic config file (not it's containing directory) - Correctly use redis user and group from template --- templates/prepare-config.sh.j2 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/prepare-config.sh.j2 b/templates/prepare-config.sh.j2 index 5094bff8..47c6bb80 100644 --- a/templates/prepare-config.sh.j2 +++ b/templates/prepare-config.sh.j2 @@ -1,6 +1,9 @@ #!/bin/bash -set -ex +set -e + +redis_user="{{ redis_user }}" +redis_group="{{ redis_group }}" static_cfg="$1" dyn_cfg="$2" @@ -29,6 +32,6 @@ else dyn_cfg_data=$(sed -n '/CONFIG REWRITE/,$p' "$dyn_cfg"; grep -F 'sentinel myid' "$dyn_cfg" || :) cat "$static_cfg" - <<< "$dyn_cfg_data" | filter_cfg > "$dyn_cfg" + chown "$redis_user:$redis_group" "$dyn_cfg" + chmod 0640 "$dyn_cfg" fi - -chown -R redis:redis "$(dirname "$dyn_cfg")"