From 7195f55c586013b843ec420a7adaceff5b6fb7ae Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Thu, 18 Jan 2007 22:10:08 +0000 Subject: [PATCH] - fix newline problem with PLC_API_MAINTENANCE_SOURCES regeneration - bootstrap the DB here instead of in db --- plc.d/api | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/plc.d/api b/plc.d/api index 0c7a4a7..1b9bc03 100755 --- a/plc.d/api +++ b/plc.d/api @@ -8,7 +8,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: api,v 1.5 2006/07/10 21:08:06 mlhuang Exp $ +# $Id: api,v 1.6 2007/01/18 18:44:18 mlhuang Exp $ # # Source function library and configuration @@ -27,9 +27,6 @@ case "$1" in MESSAGE=$"Configuring the API" dialog "$MESSAGE" - # Generate old DB configuration file - ln -sf plc_config /etc/planetlab/plc_db - # Make sure that the API maintenance account is protected by a # password. if [ -z "$PLC_API_MAINTENANCE_PASSWORD" ] ; then @@ -39,14 +36,23 @@ case "$1" in # Make sure that all PLC servers are allowed to access the API # through the maintenance account. - PLC_API_MAINTENANCE_SOURCES=$( - for server in API BOOT WWW ; do - hostname=PLC_${server}_HOST - gethostbyname ${!hostname} - done | sort -u - ) + for server in API BOOT WWW ; do + hostname=PLC_${server}_HOST + ip=$(gethostbyname ${!hostname}) + if [ -n "$ip" ] ; then + if [ -z "$PLC_API_MAINTENANCE_SOURCES" ] ; then + PLC_API_MAINTENANCE_SOURCES=$ip + else + PLC_API_MAINTENANCE_SOURCES="$PLC_API_MAINTENANCE_SOURCES $ip" + fi + fi + done plc-config --category=plc_api --variable=maintenance_sources --value="$PLC_API_MAINTENANCE_SOURCES" --save + # Bootstrap the DB + db-config + check + result "$MESSAGE" ;; esac -- 2.43.0