svn-keywords
[myplc.git] / plc.d / api
index c88ed31..4061b8d 100755 (executable)
--- a/plc.d/api
+++ b/plc.d/api
@@ -1,6 +1,8 @@
 #!/bin/bash
+# $Id$
+# $URL$
 #
-# priority: 450
+# priority: 800
 #
 # Configure the API. Must be done after SSL certificates are generated
 # and before the API web server is brought up.
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id$
-#
 
 # Source function library and configuration
 . /etc/plc.d/functions
 . /etc/planetlab/plc_config
+local_config=/etc/planetlab/configs/site.xml
 
 # Be verbose
 set -x
@@ -31,7 +32,8 @@ case "$1" in
        # password.
        if [ -z "$PLC_API_MAINTENANCE_PASSWORD" ] ; then
            PLC_API_MAINTENANCE_PASSWORD=$(uuidgen)
-           plc-config --category=plc_api --variable=maintenance_password --value="$PLC_API_MAINTENANCE_PASSWORD" --save
+           plc-config --category=plc_api --variable=maintenance_password --value="$PLC_API_MAINTENANCE_PASSWORD" --save=$local_config $local_config
+           service plc reload
        fi
 
        # Make sure that all PLC servers are allowed to access the API
@@ -46,11 +48,8 @@ case "$1" in
            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
-       db-config
-       check
+       plc-config --category=plc_api --variable=maintenance_sources --value="$PLC_API_MAINTENANCE_SOURCES" --save=$local_config $local_config
+       service plc reload
 
        result "$MESSAGE"
        ;;