Issue 710: public templates are now readable

This commit is contained in:
Adrian Cole 2012-01-12 19:23:39 -08:00
parent 3871255ccc
commit c964b207a7
2 changed files with 10 additions and 2 deletions

View File

@ -81,7 +81,11 @@ public class HardwareForVAppTemplate implements Function<VAppTemplate, Hardware>
} }
VirtualHardwareSection hardware = Iterables.get(ovf.getVirtualSystem().getVirtualHardwareSections(), 0); VirtualHardwareSection hardware = Iterables.get(ovf.getVirtualSystem().getVirtualHardwareSections(), 0);
HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems()); HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
builder.location(findLocationForResource.apply(checkNotNull(from.getVDC(), "VDC"))); if (from.getVDC() != null) {
builder.location(findLocationForResource.apply(from.getVDC()));
} else {
// otherwise, it could be in a public catalog, which is not assigned to a VDC
}
builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage( builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
ImagePredicates.idEquals(from.getHref().toASCIIString())); ImagePredicates.idEquals(from.getHref().toASCIIString()));
return builder.build(); return builder.build();

View File

@ -53,7 +53,11 @@ public class ImageForVAppTemplate implements Function<VAppTemplate, Image> {
builder.ids(from.getHref().toASCIIString()); builder.ids(from.getHref().toASCIIString());
builder.uri(from.getHref()); builder.uri(from.getHref());
builder.name(from.getName()); builder.name(from.getName());
builder.location(findLocationForResource.apply(checkNotNull(from.getVDC(), "VDC"))); if (from.getVDC() != null) {
builder.location(findLocationForResource.apply(from.getVDC()));
} else {
// otherwise, it could be in a public catalog, which is not assigned to a VDC
}
builder.description(from.getDescription() != null ? from.getDescription() : from.getName()); builder.description(from.getDescription() != null ? from.getDescription() : from.getName());
Envelope ovf = client.getVAppTemplateClient().getOvfEnvelopeForVAppTemplate(from.getHref()); Envelope ovf = client.getVAppTemplateClient().getOvfEnvelopeForVAppTemplate(from.getHref());
builder.operatingSystem(CIMOperatingSystem.toComputeOs(ovf)); builder.operatingSystem(CIMOperatingSystem.toComputeOs(ovf));