From 4c52b10f936e7aab0791ce37d51ed65a3f7332b2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 29 Sep 2014 10:57:27 +0200 Subject: [PATCH] maybe better define variable _before_ using it Signed-off-by: Steven Armstrong --- cdist/conf/type/__ssh_authorized_key/gencode-remote | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cdist/conf/type/__ssh_authorized_key/gencode-remote b/cdist/conf/type/__ssh_authorized_key/gencode-remote index 7224f039..8a5276b8 100755 --- a/cdist/conf/type/__ssh_authorized_key/gencode-remote +++ b/cdist/conf/type/__ssh_authorized_key/gencode-remote @@ -18,6 +18,8 @@ # along with cdist. If not, see . # +set -u + remove_line() { file="$1" line="$2" @@ -74,6 +76,7 @@ if [ -s "$__object/explorer/entry" ]; then fi # Determine the current state +entry="$(cat "$__object/files/should")" state_should="$(cat "$__object/parameter/state")" if grep -q -F -x "$entry" "$__object/explorer/entry"; then state_is="present" @@ -87,7 +90,6 @@ if [ "$state_should" = "$state_is" ]; then exit 0 fi -entry="$(cat "$__object/files/should")" case "$state_should" in present) add_line "$file" "$entry"