Commit de065477 authored by Leigh Stoller's avatar Leigh Stoller

Minor bug fix; when expiring slices, watch for user no longer

existing, and skip sending email.
parent 5c1ced81
#!/usr/bin/perl -w
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# Copyright (c) 2008-2011 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -191,7 +191,17 @@ sub WarnSlices()
}
my $geniuser = GeniUser->Lookup($slice->creator_uuid(), 1);
my $emailaddr = $geniuser->email();
my $emailaddr = (defined($geniuser) ? geniuser->email() : undef);
if (!defined($geniuser)) {
#
# No user to warn
#
print STDERR "Creator no longer exists for $slice. Skipping ...\n";
$warned{$idx} = time();
$expires{$idx} = $stamp;
$slice->UnLock();
goto skip;
}
my $urn = $slice->urn();
my $hrn = $slice->hrn();
my $diff = $stamp - time();
......@@ -292,7 +302,7 @@ sub ExpireSlices()
goto skip;
}
my $geniuser = GeniUser->Lookup($slice->creator_uuid(), 1);
my $emailaddr = $geniuser->email();
my $emailaddr = (defined($geniuser) ? geniuser->email() : undef);
my $urn = $slice->urn();
my $hrn = $slice->hrn();
......@@ -309,11 +319,12 @@ sub ExpireSlices()
$slice->UnLock();
goto skip;
}
SENDMAIL($emailaddr, "Slice $urn has expired",
"Slice $urn\n".
"has been expired. Sorry :-(\n",
undef, "CC: $TBOPS");
if (defined($emailaddr)) {
SENDMAIL($emailaddr, "Slice $urn has expired",
"Slice $urn\n".
"has been expired. Sorry :-(\n",
undef, "CC: $TBOPS");
}
delete($warned{"$idx"});
delete($expires{"$idx"});
skip:
......
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