neykov commented on this pull request.


> +               }
+            }, null);
+   }
+
+   @Override
+   public Iterable<Location> listLocations() {
+      return ImmutableList.of(
+              new 
LocationBuilder().id("localhost").description("localhost").scope(LocationScope.HOST).build());
+   }
+
+   @Override
+   public VagrantNode getNode(String id) {
+      // needed for 
BaseComputeServiceLiveTest.testAScriptExecutionAfterBootWithBasicTemplate()
+      // waits for the thread updating the credentialStore to execute
+      try {
+         Thread.sleep(200);

That's a very ugly hack to work around the following scenario:
  * a call to `client.submitScriptOnNode(node.getId(), AdminAccess.builder()...`
  * which schedules 
`persistNodeCredentials.ifAdminAccess(runScript).apply(node1);`
  * followed immediately by `client.getNodeMetadata(node.getId());`

Usually calls to `getNodeMetadata` involve network IO and take some time to 
complete. This gives time to the `persistNodeCredentials.ifAdminAccess` call to 
execute. In the vagrant case though `getNodeMetadata` completes quickly, before 
`persistNodeCredentials.ifAdminAccess` has the chance to execute. This results 
in the old credentials returned with the metadata.

Couldn't see a clean way to fix this from the provider. Could change 
`submitScriptOnNode` to return a future that gets resolved only after the task 
listener completes, wdyt?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/160

Reply via email to