Commit 18309e03 authored by Leigh Stoller's avatar Leigh Stoller

Return image description in image list, allow setting the image

description in CreateImage();
parent 919601db
......@@ -443,6 +443,18 @@ sub SetProvenance($$)
return 0;
}
sub SetDescription($$)
{
my ($self, $description) = @_;
my $args = {"description" => $description};
return -1
if ($self->image()->Update($args) ||
$self->osinfo()->Update($args));
return 0;
}
#
# Highest number version, rather then what is deemed most recent by the
# images table.
......
......@@ -3348,6 +3348,7 @@ sub CreateImage($)
my $update_prepare = 0;
my ($bsname,$blockstore);
my $copyback_uuid;
my $description;
my $response;
require EmulabConstants;
......@@ -3385,6 +3386,14 @@ sub CreateImage($)
return GeniResponse->MalformedArgsResponse("Improper copyback argument")
if ($copyback_uuid !~ /^[-\w\.\+]*$/);
}
# Optional description.
if (exists($argref->{'description'})) {
$description = $argref->{'description'};
return GeniResponse->MalformedArgsResponse("Improper description")
if (!TBcheck_dbslot($description, "images", "description",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR));
}
my ($credential,$speaksfor) = GeniStd::CheckCredentials($credentials);
return $credential
if (GeniResponse::IsResponse($credential));
......@@ -3625,6 +3634,13 @@ sub CreateImage($)
(defined($speaksfor) ?
$speaksfor->target_urn() : $ENV{'GENIURN'})});
}
#
# Optional descriptive text.
#
if (defined($description)) {
$image->SetDescription($description);
}
#
# Form an image URN so the user knows how to request the new image.
#
......@@ -4259,6 +4275,7 @@ sub ListImages($)
"created" => emutil::TBDateStringGMT($image->created()),
"updated" => emutil::TBDateStringGMT($image->updated()),
"format" => $image->format(),
"description" => $image->description(),
};
#
......
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