Commit b11e7973 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Fix for issue #299 ... waiting for Rob to test before closing.

parent b7d65aa3
......@@ -144,7 +144,7 @@ sub StartMonitor();
sub StartMonitorInternal(;$@);
sub DoImageTrackerStuff($$$$$$$);
sub DenyExtensionInternal($);
sub ExtendInternal($$$$);
sub ExtendInternal($$$$$);
#
# Parse command arguments. Once we return from getopts, all that should be
......@@ -1543,7 +1543,7 @@ sub DoExtend()
my $seconds = $granted * 3600;
$seconds *= 24 if (!$inhours);
if ($errcode = ExtendInternal($slice, $seconds, 0, \$errmsg)) {
if ($errcode = ExtendInternal($slice, $seconds, 0, 0, \$errmsg)) {
goto bad;
}
}
......@@ -1660,9 +1660,9 @@ sub DoExtend()
}
exit($errcode);
}
sub ExtendInternal($$$$)
sub ExtendInternal($$$$$)
{
my ($slice, $seconds, $force, $perrmsg) = @_;
my ($slice, $seconds, $force, $nolockdown, $perrmsg) = @_;
my $lockdown = 0;
my $errcode = -1;
my $errmsg;
......@@ -1671,7 +1671,7 @@ sub ExtendInternal($$$$)
my $oldexpires = $slice->expires();
# Lockdown on admin extensions longer then XX days.
if (defined($this_user) && $this_user->IsAdmin() &&
if (defined($this_user) && $this_user->IsAdmin() && !$nolockdown &&
($seconds / (24 * 60 * 60)) > 10) {
$lockdown = 1
}
......@@ -3823,9 +3823,16 @@ sub DoSchedTerminate()
# a legal thing to do (although our CM actually permits this).
#
if ($expires_time < time() + ($days * 3600 * 24)) {
my $seconds = (time() + ($days * 3600 * 24)) - $expires_time;
my $seconds;
if ($errcode = ExtendInternal($slice, $seconds, 1, \$errmsg)) {
if ($slice->IsExpired()) {
# ExtendInternal handles expired slices differently.
$seconds = ($days * 3600 * 24);
}
else {
$seconds = (time() + ($days * 3600 * 24)) - $expires_time;
}
if ($errcode = ExtendInternal($slice, $seconds, 1, 1, \$errmsg)) {
goto bad;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment