svn commit: r228850 - projects/portbuild/scripts
Mark Linimon
linimon at FreeBSD.org
Fri Dec 23 20:57:26 UTC 2011
Author: linimon (doc,ports committer)
Date: Fri Dec 23 20:57:25 2011
New Revision: 228850
URL: http://svn.freebsd.org/changeset/base/228850
Log:
Make these scripts more robust. The particular error was triggered when
switching a machine from amd64 to i386.
Modified:
projects/portbuild/scripts/pollmachine
projects/portbuild/scripts/reportload
Modified: projects/portbuild/scripts/pollmachine
==============================================================================
--- projects/portbuild/scripts/pollmachine Fri Dec 23 20:11:37 2011 (r228849)
+++ projects/portbuild/scripts/pollmachine Fri Dec 23 20:57:25 2011 (r228850)
@@ -188,12 +188,15 @@ class MachinePoll(threading.Thread):
line=line.rstrip()
part=line.partition('=')
if part[1] != '=' or not part[0]:
-# if "No such file or directory" in line:
-# # Client may require setting up post-boot
-# dosetup=1
logging.info("[%s] Bad input: %s" % (self.mach, line))
- # Assume client needs setting up
- dosetup=1
+ if "No such file or directory" in line:
+ # client requires manual setup, do not attempt to set up
+ # to avoid just filling up the error log
+ logging.info("[%s] you MUST set the client up manually" % self.mach)
+ dosetup=0
+ else:
+ # attempt to set client up
+ dosetup=1
try:
old = self.vars[part[0]]
except KeyError:
Modified: projects/portbuild/scripts/reportload
==============================================================================
--- projects/portbuild/scripts/reportload Fri Dec 23 20:11:37 2011 (r228849)
+++ projects/portbuild/scripts/reportload Fri Dec 23 20:57:25 2011 (r228850)
@@ -9,14 +9,36 @@ pbd=${PORTBUILD_DATA:-/var/portbuild}
arch=$(uname -m)
osver=$(sysctl -n kern.osreldate)
-. ${pbd}/${arch}/client.conf
-. ${pbd}/${arch}/portbuild.conf
-if [ -f ${pbd}/${arch}/portbuild.$(hostname) ]; then
- . ${pbd}/${arch}/portbuild.$(hostname)
+# set up configuration, or immediately error out if impossible
+error=
+if [ ! -d ${pbd}/${arch} ]; then
+ error="disk"
+else
+ if [ ! -f ${pbd}/${arch}/client.conf ]; then
+ error="disk"
+ else
+ . ${pbd}/${arch}/client.conf
+ fi
+ if [ ! -f ${pbd}/${arch}/portbuild.conf ]; then
+ error="disk"
+ else
+ . ${pbd}/${arch}/portbuild.conf
+ fi
+ if [ -f ${pbd}/${arch}/portbuild.$(hostname) ]; then
+ . ${pbd}/${arch}/portbuild.$(hostname)
+ fi
+
+ # iterate buildenvs
+ cd ${pbd}/${arch}
+ for i in */builds/*; do
+ buildenv=${arch}/${i%%/*}/${i##*/}
+ if [ -f ${i}/.ready ]; then
+ buildenvs="${buildenv} ${buildenvs}"
+ fi
+ done
fi
# Look for exceptional conditions
-error=
for i in squid disk; do
if [ -f ${scratchdir}/.${i} ]; then
error="${i} ${error}"
@@ -35,15 +57,6 @@ num=$(echo $(ls -1d ${scratchdir}/*/*/*/
echo "arch=${arch}"
echo "osversion=${osver}"
echo "jobs=${num}"
-
-cd ${pbd}/${arch}
-for i in */builds/*; do
- buildenv=${arch}/${i%%/*}/${i##*/}
- if [ -f ${i}/.ready ]; then
- buildenvs="${buildenv} ${buildenvs}"
- fi
-done
echo "buildenvs=${buildenvs}"
-echo -n "load="
-uptime
+echo -n "load="`uptime`
echo "error=${error}"
More information about the svn-src-projects
mailing list