[Swift-commit] r5165 - branches/release-0.93/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Sat Sep 24 15:59:40 CDT 2011


Author: davidk
Date: 2011-09-24 15:59:40 -0500 (Sat, 24 Sep 2011)
New Revision: 5165

Modified:
   branches/release-0.93/bin/gensites
Log:
Make swift.properties optional - if not defined, use environment variables
Add tc file generation from trunk


Modified: branches/release-0.93/bin/gensites
===================================================================
--- branches/release-0.93/bin/gensites	2011-09-24 18:10:59 UTC (rev 5164)
+++ branches/release-0.93/bin/gensites	2011-09-24 20:59:40 UTC (rev 5165)
@@ -45,7 +45,7 @@
 
    Examples:
 
-   Create a site configuration file for sites.xml using default properties.file in current directory
+   Create a site configuration file for sites.xml using swift.properties in current directory
    	$ gensites pads > sites.xml
 
    Use a specific properties file for a site
@@ -134,52 +134,50 @@
 
 # Ensure a properties file exists
 if [ ! -f "$PROPERTIES_FILE" ]; then
-   PROPERTIES_FILE="swift.properties"
+   PROPERTIES_FILE="./swift.properties"
    if [ ! -f "$PROPERTIES_FILE" ]; then
       PROPERTIES_FILE="$HOME/.swift/swift.properties"
-      if [ ! -f "$PROPERTIES_FILE" ]; then
-         crash "Unable to find a valid properties file! Please specify a valid file with the -p option"
-      fi
    fi
 fi
 
 # Parse values into variables for later sed processing
-#WORK=`pwd`"/work"
-while read line
-do
-   case "$line" in
-      "#site $TEMPLATE work="*|'#site work='*) 
-         WORK=`get_value $line`
-         ;;
-      "#site $TEMPLATE globus_hostname="*|'#site globus_hostname=') 
-         GLOBUS_HOSTNAME=`get_value $line`
-         ;;
-      "#site $TEMPLATE nodes="*|'#site nodes='*)
-         NODES=`get_value $line`
-         ;;
-      "#site $TEMPLATE project="*|'#site project='*)
-         PROJECT=`get_value $line`
-         ;;
-      "#site $TEMPLATE queue="*|'#site queue='*)
-         QUEUE=`get_value $line`
-         ;;
-      "#site $TEMPLATE n_gran="*|'#site n_gran='*)
-         N_GRAN=`get_value $line`
-         ;;
-      "#site $TEMPLATE n_max="*|'#site n_max='*)
-         MAXTIME=`get_value $line`
-         ;;
-      "#site $TEMPLATE slots="*|'#site slots='*)
-         SLOTS=`get_value $line`
-         ;;
-      "#site $TEMPLATE execution_url="*|'#site execution_url='*)
-        EXECUTION_URL=`get_value $line`
-        ;;
-      "#site $TEMPLATE internalhostname="*|'#site internalhostname='*)
-         INTERNALHOSTNAME=`get_value $line`
-         ;;
-   esac
-done < $PROPERTIES_FILE
+if [ -f "$PROPERTIES_FILE" ]; then
+   while read line
+   do
+      case "$line" in
+         "#site $TEMPLATE work="*|'#site work='*) 
+            WORK=`get_value $line`
+            ;;
+         "#site $TEMPLATE globus_hostname="*|'#site globus_hostname=') 
+            GLOBUS_HOSTNAME=`get_value $line`
+            ;;
+         "#site $TEMPLATE nodes="*|'#site nodes='*)
+            NODES=`get_value $line`
+            ;;
+         "#site $TEMPLATE project="*|'#site project='*)
+            PROJECT=`get_value $line`
+            ;;
+         "#site $TEMPLATE queue="*|'#site queue='*)
+            QUEUE=`get_value $line`
+            ;;
+         "#site $TEMPLATE n_gran="*|'#site n_gran='*)
+            N_GRAN=`get_value $line`
+            ;;
+         "#site $TEMPLATE n_max="*|'#site n_max='*)
+            MAXTIME=`get_value $line`
+            ;;
+         "#site $TEMPLATE slots="*|'#site slots='*)
+            SLOTS=`get_value $line`
+            ;;
+         "#site $TEMPLATE execution_url="*|'#site execution_url='*)
+            EXECUTION_URL=`get_value $line`
+           ;;
+         "#site $TEMPLATE internalhostname="*|'#site internalhostname='*)
+            INTERNALHOSTNAME=`get_value $line`
+            ;;
+      esac
+   done < $PROPERTIES_FILE
+fi
 
 # Verify that the variables by the template are defined
 for TOKEN in NODES HOST WORK PROJECT QUEUE N_GRAN N_MAX SLOTS INTERNALHOSTNAME MAXTIME EXECUTION_URL




More information about the Swift-commit mailing list