[Swift-commit] r7405 - trunk/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Wed Dec 11 10:01:58 CST 2013


Author: davidk
Date: 2013-12-11 10:01:58 -0600 (Wed, 11 Dec 2013)
New Revision: 7405

Modified:
   trunk/bin/swiftrun
Log:
Allow a -properties option to append to the default search path


Modified: trunk/bin/swiftrun
===================================================================
--- trunk/bin/swiftrun	2013-12-11 11:19:35 UTC (rev 7404)
+++ trunk/bin/swiftrun	2013-12-11 16:01:58 UTC (rev 7405)
@@ -18,6 +18,7 @@
 my $option_siteslist;		# Value of -sites option, comma separated
 my $option_config;		# Value of -config option
 my $option_listconfig; 		# List configuration files used, values, then exit
+my $option_properties;          # Use a swift.properties specified in the command line
 my $option_help;                # Print help
 my $option_version;             # Print version number
 my @sites;			# List of sites from -sites in array
@@ -25,7 +26,6 @@
 my @new_swift_args;		# New command line arguments
 my @original_swift_args;	# Original arguments
 
-
 # List of xml shortcuts
 my %xml_aliases = (
                    'allocationstepsize'        => 'globus.allocationstepsize',
@@ -283,7 +283,9 @@
 sub swiftquit {
    print STDERR $_[0] . "\n";
    print " --SWIFTRUNQUIT ";
-   rmtree $run_directory || die "Failed to remove $run_directory: $!\n";
+   if (defined($run_directory) && -d "$run_directory") { 
+      rmtree $run_directory || die "Failed to remove $run_directory: $!\n";
+   }
    exit 1;
 } 
 
@@ -333,13 +335,14 @@
 @original_swift_args = @ARGV;
 GetOptionsFromArray(
            \@original_swift_args, 
-           'config=s'        => \$option_config,
-           'help'            => \$option_help,
-           'listconfig'      => \$option_listconfig,
-           'site|sites=s'    => \$option_siteslist,
-           'sitesfile=s'     => \$option_sitesfile,
-           'tcfile=s'        => \$option_tcfile,
-           'version'         => \$option_version,
+           'config=s'              => \$option_config,
+           'help'                  => \$option_help,
+           'listconfig'      	   => \$option_listconfig,
+           'property|properties=s' => \$option_properties,
+           'site|sites=s'          => \$option_siteslist,
+           'sitesfile=s'           => \$option_sitesfile,
+           'tcfile=s'              => \$option_tcfile,
+           'version'               => \$option_version,
 );
 
 # Set @sites array from comma separated list of sites
@@ -356,6 +359,12 @@
 &add_property_file("$ENV{SWIFT_SITE_CONF}/swift.properties") if defined($ENV{SWIFT_SITE_CONF});
 &add_property_file("$ENV{HOME}/.swift/swift.properties");
 &add_property_file("swift.properties");
+if(defined($option_properties)) {
+   if(! -f $option_properties) {
+      swiftquit("Unable to find properties file $option_properties");
+   }
+   &add_property_file($option_properties);
+}
 
 # Set property values
 foreach my $property_file(@property_files) {
@@ -443,10 +452,10 @@
    $arg =~ s/tcfile/tc.file/g;
 }
 
-# Make sure -sites isn't in the arguments we send back to swift
+# Make sure swiftrun arguments aren't sent back to swift
 while( @ARGV ) {
    my $option = shift;
-   if ( $option eq "-site" || $option eq "-sites" ) { shift; }
+   if ( $option eq "-site" || $option eq "-sites" || $option eq "-properties" || $option eq "-property") { shift; }
    else { push( @new_swift_args, $option ); }
 }
 




More information about the Swift-commit mailing list