Merge success_upload and success_directive into top-level
authorJacob Bachmeyer <jcb@gnu.org>
Wed, 16 Nov 2022 00:26:42 +0000 (18:26 -0600)
committerJacob Bachmeyer <jcb@gnu.org>
Wed, 16 Nov 2022 00:26:42 +0000 (18:26 -0600)
gatekeeper.pl

index 1aedbe3882acda6f5ccee9d5cb5c654c24749af9..1f848a36948e7e9559df58cd3395f9b54053b35a 100755 (executable)
@@ -2572,32 +2572,6 @@ sub execute_commands {
 # - Clean up
 #
 
-# Report success and unlink the directive file.
-#
-sub success_upload {
-  my $sig_file = shift;
-  my $upload_file = shift;
-  my $directive_file = shift;
-
-  our $Scratch_dir;
-
-  mail ("upload of $upload_file and $sig_file complete",1);
-
-  unlink File::Spec->catfile($Scratch_dir, $directive_file)
-    or warn "unlink($directive_file) failed: $!";
-}
-
-sub success_directive {
-  my $directive_file = shift;
-
-  our $Scratch_dir;
-
-  mail ("processing of $directive_file complete",1);
-
-  unlink File::Spec->catfile($Scratch_dir, $directive_file)
-    or warn "unlink($directive_file) failed: $!";
-}
-
 =item cleanup_dir ( $directory )
 
 Remove all files older than one day from DIRECTORY.
@@ -2791,13 +2765,18 @@ foreach my $packet (@packets) { # each list element is an array reference
 
   if ($complete) {
     local $Phase = 'RP';
+    our $Scratch_dir;
 
     # report success
-    if (!$directive_only) {
-      success_upload($sig_file, $upload_file, $directive_file);
+    if ($directive_only) {
+      mail("processing of $directive_file complete",1);
     } else {
-      success_directive($directive_file);
+      mail("upload of $upload_file and $sig_file complete",1);
     }
+
+    # unlink the directive file
+    unlink File::Spec->catfile($Scratch_dir, $directive_file)
+      or warn "unlink($directive_file) failed: $!";
   } else {
     local $Phase = 'RP';