Commit 21a0b623 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Fixes for update. Modify redeemticket to accept ticket from file.

parent ba6034e0
......@@ -870,6 +870,8 @@ sub Update
return $cred
if (GeniResponse::IsResponse($cred));
my ($slice, $aggregate) = GeniCMV2::Credential2SliceAggregate($cred);
# The URN list must be either empty or contain the slice URN.
if (scalar(@urns) > 1 ||
(scalar(@urns) == 1 && $urns[0] ne $slice->urn())) {
......@@ -888,7 +890,6 @@ sub Update
return $response
if (defined($response));
my ($slice, $aggregate) = GeniCMV2::Credential2SliceAggregate($cred);
my $ticket;
if (defined($slice)) {
return $slice
......@@ -1179,6 +1180,36 @@ sub Delete
return $response;
}
sub Cancel
{
my ($urn_args, $credential_args, $option_args) = @_;
my @urns = @{ $urn_args };
return GeniResponse->MalformedArgsResposne("Empty URN List")
if (scalar(@urns) < 1);
my $credentials = FilterCredentials($credential_args);
my $cred = GeniCMV2::CheckCredentials($credentials);
return $cred
if (GeniResponse::IsResponse($cred));
my ($slice, undef) = GeniCMV2::Credential2SliceAggregate($cred);
my $response;
my $ticket = GeniTicket->SliceTicket($slice);
if (defined($ticket)) {
my $credentials = FilterCredentials($credential_args);
my $args = {
'slice_urn' => $urns[0],
'ticket' => $ticket->ticket_string(),
'credentials' => $credentials
};
$response = GeniCMV2::ReleaseTicket($args);
}
if (! GeniResponse::IsError($response)) {
$response = Describe($urn_args, $credential_args, []);
}
return $response;
}
# Filter out any credentials of an uknown type leaving only geni_sfa
# version 2 and version 3 credentials in a list. Also invokes
# auto_add_sa on each credential.
......
......@@ -50,6 +50,16 @@ execfile( "test-common.py" )
mycredential = get_self_credential()
print "Got my SA credential"
ticket = "";
if len(REQARGS) == 1:
try:
ticketfile = open(REQARGS[0])
ticket = ticketfile.read()
ticketfile.close()
except IOError, e:
print >> sys.stderr, args[0] + ": " + e.strerror
sys.exit(1)
#
# Lookup my ssh keys.
#
......@@ -84,37 +94,38 @@ else:
print "Got the slice credential"
pass
#
# Do a resolve to get the ticket urn.
#
print "Resolving the slice at the CM"
params = {}
params["credentials"] = (slicecred,)
params["urn"] = myslice["urn"]
rval,response = do_method("cm", "Resolve", params, version="2.0")
if rval:
if ticket == "":
#
# Do a resolve to get the ticket urn.
#
print "Resolving the slice at the CM"
params = {}
params["credentials"] = (slicecred,)
params["urn"] = myslice["urn"]
rval,response = do_method("cm", "Resolve", params, version="2.0")
if rval:
Fatal("Could not resolve slice")
pass
mysliver = response["value"]
print str(mysliver)
mysliver = response["value"]
print str(mysliver)
if not "ticket_urn" in mysliver:
if not "ticket_urn" in mysliver:
Fatal("No ticket exists for slice")
pass
#
# Get the ticket with another call to resolve.
#
print "Asking for a copy of the ticket"
params = {}
params["credentials"] = (slicecred,)
params["urn"] = mysliver["ticket_urn"]
rval,response = do_method("cm", "Resolve", params, version="2.0")
if rval:
#
# Get the ticket with another call to resolve.
#
print "Asking for a copy of the ticket"
params = {}
params["credentials"] = (slicecred,)
params["urn"] = mysliver["ticket_urn"]
rval,response = do_method("cm", "Resolve", params, version="2.0")
if rval:
Fatal("Could not get the ticket")
pass
ticket = response["value"]
print "Got the ticket"
ticket = response["value"]
print "Got the ticket"
redeemcred = slicecred;
#
......@@ -126,8 +137,8 @@ params["slice_urn"] = myslice["urn"]
params["credentials"] = (slicecred,)
rval,response = do_method("cm", "GetSliver", params, version="2.0")
if not rval:
redeemcred = response["value"]
print "Got the sliver credential"
redeemcred = response["value"]
print "Got the sliver credential"
#
# And redeem the ticket.
......
Supports Markdown
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