Andrew Bogott has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/334365 )
Change subject: New labs instances: Fail more obviously if we have DNS issues ...................................................................... New labs instances: Fail more obviously if we have DNS issues Change-Id: I06efaf3a75b108ab29de8783f3abbd9272943c6f --- M modules/labs_bootstrapvz/files/firstboot.sh M modules/labs_vmbuilder/files/firstboot.sh 2 files changed, 13 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/65/334365/1 diff --git a/modules/labs_bootstrapvz/files/firstboot.sh b/modules/labs_bootstrapvz/files/firstboot.sh index fe5e3d4..1cd5550 100644 --- a/modules/labs_bootstrapvz/files/firstboot.sh +++ b/modules/labs_bootstrapvz/files/firstboot.sh @@ -78,6 +78,7 @@ if [ -z $domain ]; then echo "Unable to determine domain; all is lost." + exit 1 fi diff --git a/modules/labs_vmbuilder/files/firstboot.sh b/modules/labs_vmbuilder/files/firstboot.sh index 1f11287..de4b823 100644 --- a/modules/labs_vmbuilder/files/firstboot.sh +++ b/modules/labs_vmbuilder/files/firstboot.sh @@ -44,8 +44,20 @@ project=`curl http://169.254.169.254/openstack/latest/meta_data.json/ | sed -r 's/^.*project_id\": \"//' | sed -r 's/\".*$//g'` ip=`curl http://169.254.169.254/1.0/meta-data/local-ipv4 2> /dev/null` hostname=`hostname` + # domain is the last two domain sections, e.g. eqiad.wmflabs domain=`hostname -d | sed -r 's/.*\.([^.]+\.[^.]+)$/\1/'` + +if [ -z $domain ]; then + echo "hostname -d failed, trying to parse dhcp lease" + domain=`grep "option domain-name " /var/lib/dhcp/dhclient.eth0.leases | head -n1 | cut -d \" -f2` +fi + +if [ -z $domain ]; then + echo "Unable to determine domain; all is lost." + exit 1 +fi + fqdn=${hostname}.${project}.${domain} saltfinger="c5:b1:35:45:3e:0a:19:70:aa:5f:3a:cf:bf:a0:61:dd" if [ "${domain}" == "eqiad.wmflabs" ] -- To view, visit https://gerrit.wikimedia.org/r/334365 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I06efaf3a75b108ab29de8783f3abbd9272943c6f Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Andrew Bogott <abog...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits