Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
moving the description files so that they will not be in the image li…
Browse files Browse the repository at this point in the history
…sting
  • Loading branch information
buzztroll committed Sep 28, 2011
1 parent 8a21ac3 commit cdf31de
Showing 1 changed file with 19 additions and 10 deletions.
Expand Up @@ -607,6 +607,7 @@ public void uploadVM(
throws ExecutionProblem
{
S3Service s3Service = null;
boolean rw = true;
try
{
AccessControlList acl = null;
Expand Down Expand Up @@ -651,6 +652,7 @@ public void uploadVM(
if (pr != null) {
pr.println("Setting permissions for common use.");
}
rw = false;
acl = AccessControlList.REST_CANNED_PUBLIC_READ;
s3Object.setAcl(acl);
}
Expand All @@ -661,7 +663,8 @@ public void uploadVM(

if(description != null)
{
String descObjName = key + this.descSuffix;
String descObjName = getDescriptionFileKey(vmName, rw);

S3Object descObj = new S3Object(descObjName, description);
if (acl != null)
{
Expand Down Expand Up @@ -992,22 +995,28 @@ public FileListing[] listFiles(
}
}

private String getDescriptionFileKey(String name, boolean rw)
{
String ID = "common";
if(rw)
{
ID = this.args.getXferCanonicalID();
}
String baseKey = this.args.getXferS3BaseKey() + this.descSuffix;
String key = baseKey + "/" + ID + "/" + name;

return key;
}

private String s3DownloadImageDescription(String name, boolean rw, S3Service s3Service)
throws ExecutionProblem
{
String description = null;
String descriptionName = name + this.descSuffix;

try
{
String baseBucketName = this.args.getS3Bucket();
String ID = "common";
if(rw)
{
ID = this.args.getXferCanonicalID();
}
String baseKey = this.args.getXferS3BaseKey();
String key = baseKey + "/" + ID + "/" + descriptionName;
String baseBucketName = this.args.getS3Bucket();
String key = getDescriptionFileKey(name, rw);

s3Service = this.getService();
S3Object s3Object = s3Service.getObject(baseBucketName, key);
Expand Down

0 comments on commit cdf31de

Please sign in to comment.