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 2016/01/21 01:03:36 UTC
[12/19] jclouds 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/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/83ff38eb
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/83ff38eb
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/83ff38eb
Branch: refs/heads/master
Commit: 83ff38ebee5e410038aaae19b66ad5170757a6ac
Parents: 7e866ad
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/blob/83ff38eb/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java b/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java
index 43b1585..2d76176 100644
--- a/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/DigitalOcean2ComputeServiceAdapter.java
+++ b/providers/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");
}
}