From a22abf98d58d1aa827f9d14d44fbb1154308d2e6 Mon Sep 17 00:00:00 2001 From: Leigh B Stoller <stoller@flux.utah.edu> Date: Thu, 6 Mar 2025 15:18:22 -0700 Subject: [PATCH] Reorg a bit of duplicated code. --- apt/manage_resgroup.in | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/apt/manage_resgroup.in b/apt/manage_resgroup.in index 777f40ed42..fc372287a2 100644 --- a/apt/manage_resgroup.in +++ b/apt/manage_resgroup.in @@ -1315,25 +1315,23 @@ sub DoGroupReserve() my $freq_low = $res->{"freq_low"}; my $freq_high = $res->{"freq_high"}; my $ruuid = $res->{"uuid"}; + my $reservation; if ($update) { - my $reservation = $resgroup->Reservation($ruuid); - if ($reservation) { - $reservation->MarkSubmitted($res->{'approved'}); - next; - } + $reservation = $resgroup->Reservation($ruuid); } - my $reservation = - $resgroup->AddRFReservation($freq_low, $freq_high); if (!$reservation) { - # - # Need to do something here. - # - fatal("Could not add RF reservation to group"); + $reservation = + $resgroup->AddRFReservation($freq_low, $freq_high); + if (!$reservation) { + # + # Need to do something here. + # + fatal("Could not add RF reservation to group"); + } + # We do not trust the uuid from client, we return the new one + $res->{'freq_uuid'} = $reservation->freq_uuid(); } - # We do not trust the uuid from client, we return the new one - $res->{'freq_uuid'} = $reservation->freq_uuid(); - if ($res->{'approved'} && $DORDZ) { if (APT_RDZ::CreateClaimFromReservation( $reservation, \$errmsg, $debug)) { -- GitLab