Commit a1ca76b6 authored by Leigh B Stoller's avatar Leigh B Stoller

Watch for changed certificates but same UUID; this is an

updated cert for a slice and we need to replace it in our
database. We were already doing this in the CM code, but we
missed a spot in the CMV2 code.
parent ff4bf2d6
......@@ -2241,14 +2241,6 @@ sub Credential2SliceAggregate($)
$slice = GeniSlice->Lookup($target_uuid);
}
if (defined($slice)) {
#
# Make sure the certificate has not changed. If it has, then
# this is really a new slice. That is an error.
#
if (!$target_cert->SameCert($slice)) {
return (GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Duplicate slice URN already exists here"));
}
$aggregate = GeniAggregate->SliceAggregate($slice);
}
else {
......@@ -2265,6 +2257,31 @@ sub Credential2SliceAggregate($)
}
}
}
#
# Make sure the certificate has not changed. If it has, we have to
# check the UUID, since we need to support regen of the
# certificate, which will change the version number. Which means
# a straight comparison will fail. So look to see if the UUID is
# the same. If so, we store the new certificate.
#
if (defined($slice) && !$target_cert->SameCert($slice)) {
if ($target_cert->uuid() eq $slice->uuid()) {
print STDERR "Updating certificate for $slice to $target_cert\n";
$slice->GetCertificate()->Delete();
$slice->Flush();
$target_cert->Store();
$slice = GeniSlice->Lookup($target_cert->urn());
if (!defined($slice)) {
return (GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Problem updating slice certificate"));
}
}
else {
return (GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Duplicate slice URN already exists here"));
}
}
return ($slice, $aggregate);
}
......@@ -3108,6 +3125,18 @@ sub ConsoleURL($)
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Node is not in the proper experiment");
}
#
# Not all nodes have a tipline.
#
my $tipserver;
if ($node->TipServer(\$tipserver)) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Internal error getting console server");
}
if (!defined($tipserver)) {
return GeniResponse->Create(GENIRESPONSE_UNAVAILABLE, undef,
"No console server for node");
}
my $url = $node->GenTipAclUrl();
if (!defined($url)) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
......
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