From: Mark Huang <mlhuang@cs.princeton.edu>
Date: Fri, 19 Jan 2007 20:05:05 +0000 (+0000)
Subject: - sigh, try again to fix merge of maintenance_sources
X-Git-Tag: planetlab-4_0-rc1~37
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=fd568ac4e2db10f5887621f33e25f404129bce35;p=myplc.git

- sigh, try again to fix merge of maintenance_sources
---

diff --git a/plc.d/api b/plc.d/api
index 1b9bc03..c88ed31 100755
--- a/plc.d/api
+++ b/plc.d/api
@@ -8,7 +8,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: api,v 1.6 2007/01/18 18:44:18 mlhuang Exp $
+# $Id$
 #
 
 # Source function library and configuration
@@ -36,17 +36,16 @@ case "$1" in
 
 	# Make sure that all PLC servers are allowed to access the API
 	# through the maintenance account.
-	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_API_MAINTENANCE_SOURCES=($((
+	    for ip in $PLC_API_MAINTENANCE_SOURCES ; do
+		echo $ip
+	    done
+	    for server in API BOOT WWW ; do
+		hostname=PLC_${server}_HOST
+		gethostbyname ${!hostname}
+	    done
+        ) | sort -u))
+	PLC_API_MAINTENANCE_SOURCES=${PLC_API_MAINTENANCE_SOURCES[*]}
 	plc-config --category=plc_api --variable=maintenance_sources --value="$PLC_API_MAINTENANCE_SOURCES" --save
 
 	# Bootstrap the DB