Add empty check

This commit is contained in:
IamTheFij 2017-12-22 19:01:45 -05:00
parent 5af054ddc9
commit 432d5e1242
1 changed files with 6 additions and 2 deletions

View File

@ -5,8 +5,12 @@ set -e
has_error=0
for file in $@ ; do
head -1 "$file" | grep --quiet '^\$ANSIBLE_VAULT;' || {
echo "ERROR: $file is not encrypted"
has_error=1
if [ -s "$file" ]; then
echo "ERROR: $file is not encrypted"
has_error=1
else
echo "WARNING: $file is not encrypted but is empty"
fi
}
done