You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by to...@apache.org on 2010/12/02 06:39:07 UTC

svn commit: r1041284 - in /incubator/whirr/trunk: CHANGES.txt services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopService.java

Author: tomwhite
Date: Thu Dec  2 05:39:07 2010
New Revision: 1041284

URL: http://svn.apache.org/viewvc?rev=1041284&view=rev
Log:
WHIRR-151. Credentials not set correctly for Hadoop service configure step.

Modified:
    incubator/whirr/trunk/CHANGES.txt
    incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopService.java

Modified: incubator/whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/CHANGES.txt?rev=1041284&r1=1041283&r2=1041284&view=diff
==============================================================================
--- incubator/whirr/trunk/CHANGES.txt (original)
+++ incubator/whirr/trunk/CHANGES.txt Thu Dec  2 05:39:07 2010
@@ -20,6 +20,9 @@ Trunk (unreleased changes)
 
     WHIRR-147. Regression on launching clusters from EC2. (tomwhite)
 
+    WHIRR-151. Credentials not set correctly for Hadoop service configure step.
+    (tomwhite)
+
 Release 0.2.0 - 2010-11-04
 
   NEW FEATURES

Modified: incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopService.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopService.java?rev=1041284&r1=1041283&r2=1041284&view=diff
==============================================================================
--- incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopService.java (original)
+++ incubator/whirr/trunk/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopService.java Thu Dec  2 05:39:07 2010
@@ -61,6 +61,8 @@ import org.jclouds.compute.RunScriptOnNo
 import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.domain.Template;
 import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.options.RunScriptOptions;
+import org.jclouds.domain.Credentials;
 import org.jclouds.io.Payload;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -175,6 +177,11 @@ public class HadoopService extends Servi
           jobtrackerPublicAddress.getHostAddress(), JOBTRACKER_PORT);
     }
 
+    // Use private key to run script
+    Credentials credentials = new Credentials(
+      Iterables.get(nodes, 0).getCredentials().identity,
+      clusterSpec.readPrivateKey());
+    
     String hadoopConfigureRunUrl = clusterSpec.getConfiguration().getString(
         "whirr.hadoop-configure-runurl", "apache/hadoop/post-configure");
     Payload nnjtConfigureScript = newStringPayload(runUrls(
@@ -188,7 +195,8 @@ public class HadoopService extends Servi
     try {
       LOG.info("Running configure script on master");
       computeService.runScriptOnNodesMatching(withIds(node.getId()),
-          nnjtConfigureScript);
+          nnjtConfigureScript,
+          RunScriptOptions.Builder.overrideCredentialsWith(credentials));
     } catch (RunScriptOnNodesException e) {
       // TODO: retry
       throw new IOException(e);
@@ -217,7 +225,8 @@ public class HadoopService extends Servi
           runningWithTag(clusterSpec.getClusterName()),
           Predicates.not(withIds(node.getId())));
       computeService.runScriptOnNodesMatching(workerPredicate,
-          dnttConfigureScript);
+          dnttConfigureScript,
+          RunScriptOptions.Builder.overrideCredentialsWith(credentials));
     } catch (RunScriptOnNodesException e) {
       // TODO: retry
       throw new IOException(e);