[__directory] Give more precise error message when --state pre-exists
This commit is contained in:
parent
2cf44c66d4
commit
6b4b6534a1
1 changed files with 18 additions and 4 deletions
|
@ -109,10 +109,24 @@ case "$state_should" in
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
pre-exists)
|
pre-exists)
|
||||||
if [ "$type" != "directory" ]; then
|
case $type in
|
||||||
echo "Directory \"$destination\" does not exist" >&2
|
directory)
|
||||||
exit 1
|
# all good
|
||||||
fi
|
exit 0
|
||||||
|
;;
|
||||||
|
none)
|
||||||
|
printf 'Directory "%s" does not exist\n' "$destination" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
file|symlink)
|
||||||
|
printf 'File "%s" exists and is a %s, but should be a directory\n' "$destination" "$type" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf 'File or directory "%s" is in an unknown state\n' "$destination" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
if [ "$type" = "directory" ]; then
|
if [ "$type" = "directory" ]; then
|
||||||
|
|
Loading…
Reference in a new issue