Index: /tags/ipp-pv3-20140717/ippScripts/scripts/sc_retry_return.pl
===================================================================
--- /tags/ipp-pv3-20140717/ippScripts/scripts/sc_retry_return.pl	(revision 37269)
+++ /tags/ipp-pv3-20140717/ippScripts/scripts/sc_retry_return.pl	(revision 37270)
@@ -34,5 +34,4 @@
 # Options
 my ($remote_id,$path_base,$dbname,$verbose,$no_update,$camera);
-$force = 0;
 $verbose = 0;
 GetOptions(
@@ -77,5 +76,5 @@
 my $runData = ${ $rrData2 }[0]; # There should be only one
 
-# my job ID : 
+# my job ID :
 my $job_id = $runData->{job_id};
 print "remote job ID: $job_id\n";
@@ -132,5 +131,5 @@
     } while (($transfer_success != 1) &&  ($iter < 10));  # Try harder;
 
-    if (!$transfer_success) &my_die ("failed to get all return files");
+    if (!$transfer_success) { &my_die ("failed to get all return files"); }
 }
 print STDERR "rsync of all files is complete, updating gpc1 database\n";
@@ -145,50 +144,48 @@
     # we just need to check for the existence of an entry:
     if ($runData->{stage} == "chip") {
-	my $cmd = "$chiptool -simple -processedimfile -chip_id $stage_id -class_id $class_id";
-	$cmd   .= " -dbname $dbname " if defined($dbname);
-	
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $cmd, verbose => $verbose);
-
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to run chiptool to check on results", $remote_id,$error_code);
-	}
-
-	my $Nrows = @$stdout_buff;
-	if ($Nrows > 0) {
-	    print STDERR "skip this entry: $stage_id, $class_id\n";
-	    next;
-	}
+        my $cmd1 = "$chiptool -simple -processedimfile -chip_id $stage_id -class_id $class_id";
+        $cmd1   .= " -dbname $dbname " if defined($dbname);
+
+        my ( $success1, $error_code1, $full_buf1, $stdout_buf1, $stderr_buf1 ) =
+            run(command => $cmd1, verbose => $verbose);
+
+        unless ($success1) {
+            $error_code1 = (($error_code1 >> 8) or $PS_EXIT_PROG_ERROR);
+            &my_die("Unable to run chiptool to check on results", $remote_id, $error_code1);
+        }
+
+        my $Nrows = @$stdout_buf1;
+        if ($Nrows > 0) {
+            print STDERR "skip this entry: $stage_id, $class_id\n";
+            next;
+        }
     } else {
-	print STDERR "do not know how to handle stage $runData->{stage}\n";
-	exit (3);
-    }
-
-    {
-	open(DBF,"$file") || warn "Missing file $file\n";
-	my $cmd = <DBF>;
-	close(DBF);
-
-	chomp($cmd);
-
-	$cmd =~ s/-/ -/g; # This is just a safety check for missing space.
-	if ($cmd == "") {
-	    print STDERR "empty dbinfo file for $stage_id, $class_id, skipping\n";
-	    next;
-	}
-
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $cmd, verbose => $verbose);
-	unless ($success) {
-	    # This shouldn't fail, but we also can't suddenly abort if something does fail.
-	    # Now we're going to drop the component that owns this dbinfo, which should force a retry.
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    warn("The command that shouldn't fail has failed: $file $cmd $remote_id $error_code");
-	    if ($poll_word ne 'Completed') {  # If the job claims it completed, then we're fighting the network.
-		# drop_component($remote_id,$cmd,$file);
-		print STDERR "we should drop this component: $cmd\n";
-	    }
-	}
+        print STDERR "do not know how to handle stage $runData->{stage}\n";
+        exit (3);
+    }
+
+    open(DBF,"$file") || warn "Missing file $file\n";
+    my $cmd = <DBF>;
+    close(DBF);
+
+    chomp($cmd);
+
+    $cmd =~ s/-/ -/g; # This is just a safety check for missing space.
+    if ($cmd == "") {
+        print STDERR "empty dbinfo file for $stage_id, $class_id, skipping\n";
+        next;
+    }
+
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $cmd, verbose => $verbose);
+    unless ($success) {
+        # This shouldn't fail, but we also can't suddenly abort if something does fail.
+        # Now we're going to drop the component that owns this dbinfo, which should force a retry.
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        warn("The command that shouldn't fail has failed: $file $cmd $remote_id $error_code");
+        if ($poll_word ne 'Completed') {  # If the job claims it completed, then we're fighting the network.
+            # drop_component($remote_id,$cmd,$file);
+            print STDERR "we should drop this component: $cmd\n";
+        }
     }
 }
@@ -246,19 +243,19 @@
     my $response_array = ssh_exec_command("checkjob -v $job_id");
     my $response = join "\n", @$response_array;
-    
-    if ($response =~ /State: Running/) { 
-	return(0,"Running");
+
+    if ($response =~ /State: Running/) {
+        return(0,"Running");
     }
     elsif ($response =~ /State: Completed/) {
-	return(1,"Completed");
+        return(1,"Completed");
     }
     elsif ($response =~ /State: Idle/) {
-	return(-2,"Idle");
+        return(-2,"Idle");
     }
     else {
-	my $response_word = $response;
-	$response_word =~ s/.*State: //;
-	$response_word =~ s/\n.*//;
-	return(-1,$response_word);
+        my $response_word = $response;
+        $response_word =~ s/.*State: //;
+        $response_word =~ s/\n.*//;
+        return(-1,$response_word);
     }
 }
@@ -279,13 +276,13 @@
     elsif ($stage eq 'camera') {
         $stage_id =~ s/^.*cm\.//;
-	$class_id = 0;
+        $class_id = 0;
     }
     elsif ($stage eq 'warp') {
         $stage_id =~ s/^.*wrp\.//;
-	$class_id = 0;
+        $class_id = 0;
     }
     elsif ($stage eq 'stack') {
         $stage_id =~ s/^.*stk\.//;
-	$class_id = 0;
+        $class_id = 0;
     }
 
