From f70f822e64495b1ce88ff55ce6d6d79ac0b0a7d1 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 9 Nov 2010 04:36:04 +0100 Subject: [PATCH] fixed npe --- .../org/jclouds/compute/internal/BaseComputeService.java | 4 ---- .../main/java/org/jclouds/compute/util/ComputeUtils.java | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java b/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java index 422887ab6f..c36e6c97af 100755 --- a/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java +++ b/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java @@ -83,7 +83,6 @@ import org.jclouds.domain.Location; import org.jclouds.io.Payload; import org.jclouds.logging.Logger; import org.jclouds.predicates.RetryablePredicate; -import org.jclouds.scriptbuilder.InitBuilder; import org.jclouds.scriptbuilder.domain.Statements; import org.jclouds.ssh.ExecResponse; import org.jclouds.util.Utils; @@ -175,9 +174,6 @@ public class BaseComputeService implements ComputeService { throws RunNodesException { checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens"); checkNotNull(template.getLocation(), "location"); - if (template.getOptions().getTaskName() == null && template.getOptions().getRunScript() != null - && !(template.getOptions().getRunScript() instanceof InitBuilder)) - template.getOptions().nameTask("bootstrap"); logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) hardwareProfile(%s) options(%s)", count, count > 1 ? "s" : "", tag, template.getLocation().getId(), template.getImage().getId(), template .getHardware().getId(), template.getOptions()); diff --git a/compute/src/main/java/org/jclouds/compute/util/ComputeUtils.java b/compute/src/main/java/org/jclouds/compute/util/ComputeUtils.java index 8c54977605..9c7392d73a 100644 --- a/compute/src/main/java/org/jclouds/compute/util/ComputeUtils.java +++ b/compute/src/main/java/org/jclouds/compute/util/ComputeUtils.java @@ -55,6 +55,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts; import org.jclouds.compute.strategy.GetNodeMetadataStrategy; import org.jclouds.compute.util.ComputeServiceUtils.SshCallable; import org.jclouds.logging.Logger; +import org.jclouds.scriptbuilder.InitBuilder; import org.jclouds.scriptbuilder.domain.AuthorizeRSAPublicKey; import org.jclouds.scriptbuilder.domain.InstallRSAPrivateKey; import org.jclouds.scriptbuilder.domain.Statement; @@ -144,8 +145,11 @@ public class ComputeUtils { bootstrap.add(options.getRunScript()); if (options.getPrivateKey() != null) bootstrap.add(new InstallRSAPrivateKey(options.getPrivateKey())); - if (bootstrap.size() >= 1) + if (bootstrap.size() >= 1) { + if (options.getTaskName() == null && !(options.getRunScript() instanceof InitBuilder)) + options.nameTask("bootstrap"); runScriptOnNode(node, bootstrap.size() == 1 ? bootstrap.get(0) : new StatementList(bootstrap), options); + } return node; }