maybe better define variable _before_ using it
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
4125dfaab0
commit
4c52b10f93
1 changed files with 3 additions and 1 deletions
|
@ -18,6 +18,8 @@
|
||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -u
|
||||||
|
|
||||||
remove_line() {
|
remove_line() {
|
||||||
file="$1"
|
file="$1"
|
||||||
line="$2"
|
line="$2"
|
||||||
|
@ -74,6 +76,7 @@ if [ -s "$__object/explorer/entry" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine the current state
|
# Determine the current state
|
||||||
|
entry="$(cat "$__object/files/should")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
if grep -q -F -x "$entry" "$__object/explorer/entry"; then
|
if grep -q -F -x "$entry" "$__object/explorer/entry"; then
|
||||||
state_is="present"
|
state_is="present"
|
||||||
|
@ -87,7 +90,6 @@ if [ "$state_should" = "$state_is" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
entry="$(cat "$__object/files/should")"
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
add_line "$file" "$entry"
|
add_line "$file" "$entry"
|
||||||
|
|
Loading…
Reference in a new issue