Commit 23dbc85b authored by Leigh B Stoller's avatar Leigh B Stoller

More bug fixes ...

parent 631d1496
......@@ -187,11 +187,13 @@ sub GetCredentials($$$)
#
# Need to know if only a speaksfor is provided.
#
my ($credential,$speaksfor) =
GeniStd::CheckCredentials(GeniStd::FilterCredentials($credential_args));
return $credential
if (GeniResponse::IsResponse($credential));
my ($credential,$speaksfor);
my $credential_args = GeniStd::FilterCredentials($credential_args);
if (@{ $credential_args }) {
($credential,$speaksfor) = GeniStd::CheckCredentials($credential_args);
return $credential
if (GeniResponse::IsResponse($credential));
}
my $args = { "urn" => $member_urn };
if (defined($speaksfor)) {
$args->{"credential"} = $speaksfor->asString();
......
......@@ -48,6 +48,7 @@ use emutil;
use URI;
use Data::Dumper;
use Carp qw(cluck carp);
use POSIX qw(strftime);
# Filter out any credentials of an uknown type leaving only geni_sfa
# version 2 and version 3 credentials in a list. Also invokes
......@@ -221,6 +222,11 @@ sub CheckCredentials($;$)
}
else {
my @credential_strings = @{ $_[0] };
if (! @credential_strings) {
$error = GeniResponse->MalformedArgsResponse("You did not supply ".
"any credentials!");
goto bad;
}
#
# The only other case is that we get multiple credentials. One
# is the speaks-for credential and another one is the real
......@@ -430,3 +436,16 @@ sub GenerateEmptyManifest()
'xsi:schemaLocation="http://www.geni.net/resources/rspec/3 '.
'http://www.geni.net/resources/rspec/3/manifest.xsd ">';
}
#
# Return date in GMT time format.
#
sub DateTimeGMT($)
{
my ($datetime) = @_;
return POSIX::strftime("20%y-%m-%dT%H:%M:%S GMT",
gmtime(str2time($datetime)));
}
1;
......@@ -68,7 +68,7 @@ sub CreateSlice($$)
{
my ($credential_args, $options) = @_;
if (! defined($credential_args) ||
! defined($options) || ref($options) ne "ARRAY" ||
! defined($options) || ref($options) ne "HASH" ||
! exists($options->{'fields'}) ||
! exists($options->{'fields'}->{'SLICE_NAME'}))
{
......@@ -137,8 +137,10 @@ sub LookupSlices()
my $completeblob = {
"SLICE_URN" => $slice->urn(),
"SLICE_UID" => $slice->uuid(),
"SLICE_CREATION" => $slice->created(),
"SLICE_EXPIRATION" => $slice->expires(),
"SLICE_CREATION" =>
GeniStd::DateTimeGMT($slice->created()),
"SLICE_EXPIRATION" =>
GeniStd::DateTimeGMT($slice->expires()),
"SLICE_EXPIRED" => $isExpired,
"SLICE_NAME" => $slice->hrn(),
"SLICE_DESCRIPTION" => $description,
......@@ -206,7 +208,7 @@ sub ModifySliceMembership()
my ($slice_urn, $credential_args, $options) = @_;
if (! defined($slice_urn) ||
! defined($credential_args) ||
! defined($options) || ref($options) ne "ARRAY")
! defined($options) || ref($options) ne "HASH")
{
return GeniResponse->MalformedArgsResponse('Requires a slice urn, a list of credentials, and an options field');
}
......@@ -362,7 +364,7 @@ sub CreateSliverInfo($$$$)
{
my ($credential_args, $options) = @_;
if (! defined($credential_args) ||
! defined($options) || ref($options) ne "ARRAY")
! defined($options) || ref($options) ne "HASH")
{
return GeniResponse->MalformedArgsResponse('Requires a list of credentials, and an options field');
}
......@@ -416,7 +418,7 @@ sub LookupSliverInfo($$)
my ($credential_args, $options) = @_;
if (! (defined($credential_args) && defined($options) &&
ref($options) eq "ARRAY")) {
ref($options) eq "HASH")) {
return
GeniResponse->MalformedArgsResponse('Requires a list of '.
'credentials, and an options field');
......@@ -456,8 +458,10 @@ sub LookupSliverInfo($$)
'SLIVER_INFO_AGGREGATE_URN' => $sliver->manager_urn(),
'SLIVER_INFO_URN' => $sliver->urn(),
'SLIVER_INFO_SLICE_URN' => $slice->urn(),
'SLIVER_INFO_CREATION' => $sliver->created(),
'SLIVER_INFO_EXPIRATION' => $sliver->expires()
'SLIVER_INFO_CREATION' =>
GeniStd::DateTimeGMT($sliver->created()),
'SLIVER_INFO_EXPIRATION' =>
GeniStd::DateTimeGMT($sliver->expires())
};
my $user = User->Lookup($sliver->creator_idx());
if (defined($user)) {
......
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