"Fossies" - the Fresh Open Source Software Archive

Member "pdns-auth-4.2.0/builder-support/debian/authoritative/debian-stretch/tests/smoke-pgsql" (27 Aug 2019, 1421 Bytes) of package /linux/misc/dns/pdns-auth-4.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 exec 2>&1
    3 set -ex
    4 
    5 echo /etc/powerdns/pdns.d/pdns.local.gpgsql.conf follows:
    6 echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    7 cat  /etc/powerdns/pdns.d/pdns.local.gpgsql.conf
    8 echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    9 
   10 # gpgsql-dbname=pdnsbackendpgsql
   11 DBNAME=$(grep gpgsql-dbname   /etc/powerdns/pdns.d/pdns.local.gpgsql.conf | awk -F= '{print $2}')
   12 DBHOST=$(grep gpgsql-host     /etc/powerdns/pdns.d/pdns.local.gpgsql.conf | awk -F= '{print $2}')
   13 DBUSER=$(grep gpgsql-user     /etc/powerdns/pdns.d/pdns.local.gpgsql.conf | awk -F= '{print $2}')
   14 DBPASS=$(grep gpgsql-password /etc/powerdns/pdns.d/pdns.local.gpgsql.conf | awk -F= '{print $2}')
   15 
   16 cat <<EOF >/etc/powerdns/example.org
   17 example.org.           172800  IN      SOA     ns1.example.org. dns.example.org. 1 10800 3600 604800 3600
   18 example.org.           172800  IN      NS      ns1.example.org.
   19 smoke.example.org.     172800  IN      A       127.0.0.125
   20 EOF
   21 
   22 zone2sql --gpgsql --zone-name=example.org --zone=/etc/powerdns/example.org | \
   23     PGPASSWORD="$DBPASS" psql -h "$DBHOST" -U "$DBUSER" "$DBNAME"
   24 
   25 service pdns restart
   26 
   27 TMPFILE=$(mktemp)
   28 cleanup() {
   29   rm -f "$TMPFILE"
   30   service pdns stop
   31 }
   32 trap cleanup EXIT
   33 
   34 dig @127.0.0.1 smoke.example.org 2>&1 | tee "$TMPFILE"
   35 
   36 if grep -c '127\.0\.0\.125' "$TMPFILE"; then
   37     echo success
   38 else
   39     echo smoke.example.org could not be resolved
   40     exit 1
   41 fi
   42