add error handling and output
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jochen Welzel 2021-01-18 17:41:55 +01:00
parent 14f31f0886
commit 8ee58135ce

View File

@ -6,10 +6,25 @@ mkdir .ssh
echo $PLUGIN_KEY > .ssh/id_rsa
chmod 600 .ssh/id_rsa
echo "Changed files: $CHFILENAMES"
for file in $CHFILENAMES; do
if [[ $file == *"zone" ]]; then
echo "SCP of $file started"
scp $file "$PLUGIN_USER"@"$PLUGIN_HOSTS":"$PLUGIN_TARGET"/$file
if [ $? -ne 0 ]; then
echo "SCP failed" > &2
exit 1
fi
ZONE=$(echo $file | sed 's/\.zone//')
echo "Reload $ZONE zone"
ssh "PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-control reload $ZONE
if [ $? -ne 0 ]; then
echo "Reload of zone failed" > &2
exit 1
fi
else
echo "Nothing to upload"
fi
done
echo "All done"