mirror of https://github.com/apache/jclouds.git
added message to NPE when vdc isn't found
This commit is contained in:
parent
69a1b7a6aa
commit
281109dfc4
|
@ -18,15 +18,16 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.terremark.compute;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static com.google.common.collect.Iterables.getLast;
|
||||
import static org.jclouds.vcloud.terremark.options.AddInternetServiceOptions.Builder.withDescription;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
@ -142,16 +143,12 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
|
|||
|
||||
} else {
|
||||
logger.debug(">> adding InternetService %s:%s:%d", ip.getAddress(), protocol, port);
|
||||
is = client.addInternetServiceToExistingIp(
|
||||
ip.getId(),
|
||||
vApp.getName() + "-" + port,
|
||||
protocol,
|
||||
port,
|
||||
is = client.addInternetServiceToExistingIp(ip.getId(), vApp.getName() + "-" + port, protocol, port,
|
||||
withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(),
|
||||
vApp.getName())));
|
||||
}
|
||||
logger.debug("<< created InternetService(%s) %s:%s:%d", is.getName(), is.getPublicIpAddress().getAddress(),
|
||||
is.getProtocol(), is.getPort());
|
||||
logger.debug("<< created InternetService(%s) %s:%s:%d", is.getName(), is.getPublicIpAddress().getAddress(), is
|
||||
.getProtocol(), is.getPort());
|
||||
logger.debug(">> adding Node %s:%d -> %s:%d", is.getPublicIpAddress().getAddress(), is.getPort(),
|
||||
privateAddress, port);
|
||||
Node node = client.addNode(is.getId(), privateAddress, vApp.getName() + "-" + port, port);
|
||||
|
@ -161,6 +158,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
|
|||
}
|
||||
|
||||
private Set<PublicIpAddress> deleteInternetServicesAndNodesAssociatedWithVApp(VCloudExpressVApp vApp) {
|
||||
checkNotNull(vApp.getVDC(), "VDC reference missing for vApp(%s)", vApp.getName());
|
||||
Set<PublicIpAddress> ipAddresses = Sets.newHashSet();
|
||||
SERVICE: for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getHref())) {
|
||||
for (Node node : client.getNodes(service.getId())) {
|
||||
|
|
Loading…
Reference in New Issue