You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/10/27 23:42:19 UTC
[2/2] jclouds-labs git commit: JCLOUDS-1027: When waiting to a
droplet to be created we check the proper dropletId
JCLOUDS-1027: When waiting to a droplet to be created we check the proper dropletId
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/df44b1c8
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/df44b1c8
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/df44b1c8
Branch: refs/heads/master
Commit: df44b1c8f73f6625e8a0f86fda983b89c2afe01d
Parents: 70dba8e
Author: Ruben Rubio Rey <ru...@manageacloud.com>
Authored: Tue Oct 27 11:45:30 2015 +1100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Oct 27 23:35:36 2015 +0100
----------------------------------------------------------------------
.../DigitalOcean2ComputeServiceAdapter.java | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/df44b1c8/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java b/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java
index 43b1585..2d76176 100644
--- a/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java
+++ b/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java
@@ -21,7 +21,6 @@ import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.Iterables.concat;
import static com.google.common.collect.Iterables.contains;
import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Sets.newHashSet;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
@@ -118,7 +117,7 @@ public class DigitalOcean2ComputeServiceAdapter implements ComputeServiceAdapter
// We have to actively wait until the droplet has been provisioned until
// we can build the entire Droplet object we want to return
- nodeRunningPredicate.apply(getOnlyElement(dropletCreated.links().actions()).id());
+ nodeRunningPredicate.apply(dropletCreated.droplet().id());
Droplet droplet = api.dropletApi().get(dropletCreated.droplet().id());
LoginCredentials defaultCredentials = LoginCredentials.builder().user("root")
@@ -219,25 +218,27 @@ public class DigitalOcean2ComputeServiceAdapter implements ComputeServiceAdapter
public void rebootNode(String id) {
// We have to wait here, as the api does not properly populate the state
// but fails if there is a pending event
- Action action = api.dropletApi().reboot(Integer.parseInt(id));
- checkState(nodeRunningPredicate.apply(action.id()), "node did not restart in the configured timeout");
+ int dropletId = Integer.parseInt(id);
+ api.dropletApi().reboot(dropletId);
+ checkState(nodeRunningPredicate.apply(dropletId), "node did not restart in the configured timeout");
}
@Override
public void resumeNode(String id) {
// We have to wait here, as the api does not properly populate the state
// but fails if there is a pending event
- Action action = api.dropletApi().powerOn(Integer.parseInt(id));
- checkState(nodeRunningPredicate.apply(action.id()), "node did not started in the configured timeout");
+ int dropletId = Integer.parseInt(id);
+ api.dropletApi().powerOn(dropletId);
+ checkState(nodeRunningPredicate.apply(dropletId), "node did not started in the configured timeout");
}
@Override
public void suspendNode(String id) {
- int dropletId = Integer.parseInt(id);
// We have to wait here, as the api does not properly populate the state
// but fails if there is a pending event
+ int dropletId = Integer.parseInt(id);
Action action = api.dropletApi().powerOff(dropletId);
- checkState(nodeStoppedPredicate.apply(action.id()), "node did not stop in the configured timeout");
+ checkState(nodeStoppedPredicate.apply(dropletId), "node did not stop in the configured timeout");
}
}