From 1bb47be0dec1343b6305049d63e945f123f23aed Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Sat, 1 Jul 2023 17:42:56 -0500 Subject: [PATCH] Move successful completion flag into packet object --- gatekeeper.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index 009fd1a..cceb210 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1619,7 +1619,8 @@ sub read_directive_from_string { until substr($file, 0, length $stem) eq $stem; } - bless { files => \@files, stem => $stem, notices => [] }, $class + bless { files => \@files, stem => $stem, + notices => [], installation_successful => 0 }, $class } # store additional messages that should appear in the report @@ -1627,6 +1628,9 @@ sub read_directive_from_string { # return list of messages stored for the report sub notices { return @{(shift)->{notices}} } + # has this packet been installed into the managed tree? + sub successful { (shift)->{installation_successful} } + # scaffolding for now... sub files { @{(shift)->{files}} } sub file_name_stem { (shift)->{stem} } @@ -1705,6 +1709,8 @@ sub read_directive_from_string { ::abort "unknown internal operation: $step->[0]"; } } + + $self->{installation_successful} = 1; } } @@ -3362,8 +3368,6 @@ my @packets; } foreach my $packet (@packets) { - my $complete = 0; # direct flag to indicate successful processing - eval { # trap exceptions encountered while processing a packet local $Phase = 'PS'; $packet->parse; @@ -3377,14 +3381,12 @@ foreach my $packet (@packets) { $Phase = 'EX'; $packet->install_check; $packet->install; - - $complete = 1; }; # sending a report uses the key index keyidx_attach; - if ($complete) { + if ($packet->successful) { local $Phase = 'RP'; # Phone home. E-mail the contents of the directive file to the public -- 2.25.1