Skip to content

Commit

Permalink
WHIRR-151. Credentials not set correctly for Hadoop service configure…
Browse files Browse the repository at this point in the history
… step.

git-svn-id: https://svn.apache.org/repos/asf/incubator/whirr/trunk@1041284 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
tomwhite committed Dec 2, 2010
1 parent 13b730d commit faaeac0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
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;
Expand Down Expand Up @@ -175,6 +177,11 @@ public Set<? extends NodeMetadata> call() throws Exception {
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(
Expand All @@ -188,7 +195,8 @@ public Set<? extends NodeMetadata> call() throws Exception {
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);
Expand Down Expand Up @@ -217,7 +225,8 @@ public Set<? extends NodeMetadata> call() throws Exception {
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);
Expand Down

0 comments on commit faaeac0

Please sign in to comment.