Faidon Liambotis has uploaded a new change for review. https://gerrit.wikimedia.org/r/82264
Change subject: authdns: introduce an authdns::lint class ...................................................................... authdns: introduce an authdns::lint class It sets up gdnsd & dependencies but without the service running. This is to be used by contint to lint authdns proposed changesets. Change-Id: Ic204f65c6fd5743249ba90391cf3874d39932693 --- A modules/authdns/files/authdns-lint A modules/authdns/manifests/lint.pp M modules/authdns/manifests/scripts.pp 3 files changed, 90 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/64/82264/1 diff --git a/modules/authdns/files/authdns-lint b/modules/authdns/files/authdns-lint new file mode 100644 index 0000000..539449c --- /dev/null +++ b/modules/authdns/files/authdns-lint @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Shell script to use for linting zone templates & config. It sets up a gdnsd +# chroot directory, generates zone files based on the templates using +# authdns-gen-zones and runs gdnsd checkconf. +# +# Written by Faidon Liambotis, Aug 2013 + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +die() { echo >&2 "E: $*"; exit 1; } + +cleanup() { + if [ "$CLEANUP" = "yes" ] && [ -d "$TESTDIR" ]; then + rm -rf $TESTDIR + fi +} +trap cleanup EXIT + +WORKINGDIR=$1 +TESTDIR=$2 + +if [ -z "$WORKINGDIR" ]; then + die "no template dir specified" +fi +echo "Using $WORKINGDIR as the input working directory" + +if [ -z "$TESTDIR" ]; then + # no test directory passed, generate one and clean it up on exit + TESTDIR=$(mktemp -d --tmpdir 'authdns-lint.XXXXXX') + CLEANUP=yes +fi +echo "Using $TESTDIR as the output working directory (gdnsd chroot)" +mkdir -p $TESTDIR/etc/zones + +if [ ! -e "$WORKINGDIR/templates" ]; then + die "templates not found, system misconfigured?" +fi +if [ ! -e "$WORKINGDIR/config-geo" ]; then + die "config-geo not found, system misconfigured?" +fi + +echo "Generating zonefiles from zone templates" +authdns-gen-zones $WORKINGDIR/templates $TESTDIR/etc/zones + +echo "Generating gdnsd config" +cp -f $WORKINGDIR/config-geo $TESTDIR/etc/config + +echo "Copying GeoIP databases inside the chroot:" +sed -nr 's/.*(geoip_db(.*)?|city_region_names)\s*=>\s*//p' $TESTDIR/etc/config \ + | sort -u | while read file; do + dirname=$(dirname $file) + mkdir -p $TESTDIR/$dirname + cp $file $TESTDIR/$dirname/ + echo " $file" +done + +gdnsd -d $TESTDIR checkconf diff --git a/modules/authdns/manifests/lint.pp b/modules/authdns/manifests/lint.pp new file mode 100644 index 0000000..2e67ac3 --- /dev/null +++ b/modules/authdns/manifests/lint.pp @@ -0,0 +1,21 @@ +# == Class authdns::lint +# A class to lint Wikimedia's authoritative DNS system +# +class authdns::lint { + include authdns::scripts + + class { '::geoip': + data_provider => 'package', + } + + package { 'gdnsd': + ensure => installed, + } + + service { 'gdnsd': + ensure => 'stopped', + hasrestart => true, + hasstatus => true, + require => Package['gdnsd'], + } +} diff --git a/modules/authdns/manifests/scripts.pp b/modules/authdns/manifests/scripts.pp index afb0edc..9e9f832 100644 --- a/modules/authdns/manifests/scripts.pp +++ b/modules/authdns/manifests/scripts.pp @@ -22,6 +22,15 @@ group => 'root', source => "puppet:///modules/${module_name}/authdns-gen-zones.py", } + + file { '/usr/local/bin/authdns-lint': + ensure => present, + mode => '0555', + owner => 'root', + group => 'root', + source => "puppet:///modules/${module_name}/authdns-lint", + } + file { '/usr/local/sbin/authdns-update': ensure => present, mode => '0555', -- To view, visit https://gerrit.wikimedia.org/r/82264 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic204f65c6fd5743249ba90391cf3874d39932693 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Faidon Liambotis <fai...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits