add nsd to dockerfile and local zonefile check
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jochen Welzel 2021-01-18 20:45:06 +01:00
parent 793b657890
commit 954afd3e6e
2 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@ FROM alpine:latest
MAINTAINER Jochen Welzel MAINTAINER Jochen Welzel
RUN apk update && apk upgrade && apk add bash && apk add openssh-client && apk add git RUN apk update && apk upgrade && apk add bash && apk add openssh-client && apk add git && apk add nsd
COPY scp_and_reload.sh /usr/local/bin/ COPY scp_and_reload.sh /usr/local/bin/
RUN chmod 755 /usr/local/bin/scp_and_reload.sh RUN chmod 755 /usr/local/bin/scp_and_reload.sh

View File

@ -10,19 +10,19 @@ echo "Changed files: $CHFILENAMES"
for file in $CHFILENAMES; do for file in $CHFILENAMES; do
if [[ $file == *"zone" ]]; then if [[ $file == *"zone" ]]; then
ZONE=$(echo $file | sed 's/\.zone//')
echo "Check zone file"
nsd-checkzone $ZONE $file
if [ $? -ne 0 ]; then
echo "Zone file check failed" 1>&2
exit 1
fi
echo "SCP of $file started" echo "SCP of $file started"
scp -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $file "$PLUGIN_USER"@"$PLUGIN_HOSTS":"$PLUGIN_TARGET"/$file scp -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $file "$PLUGIN_USER"@"$PLUGIN_HOSTS":"$PLUGIN_TARGET"/$file
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "SCP failed" 1>&2 echo "SCP failed" 1>&2
exit 1 exit 1
fi fi
ZONE=$(echo $file | sed 's/\.zone//')
echo "Check uploaded zone file"
ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-checkzone $ZONE "$PLUGIN_TARGET"/"$file"
if [ $? -ne 0 ]; then
echo "Zone file check failed" 1>&2
exit 1
fi
echo "Reload $ZONE zone" echo "Reload $ZONE zone"
ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-control reload $ZONE ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-control reload $ZONE
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then