mirror of https://github.com/apache/jclouds.git
fixed npe
This commit is contained in:
parent
4dbcbfc7a6
commit
f70f822e64
|
@ -83,7 +83,6 @@ import org.jclouds.domain.Location;
|
||||||
import org.jclouds.io.Payload;
|
import org.jclouds.io.Payload;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.jclouds.scriptbuilder.InitBuilder;
|
|
||||||
import org.jclouds.scriptbuilder.domain.Statements;
|
import org.jclouds.scriptbuilder.domain.Statements;
|
||||||
import org.jclouds.ssh.ExecResponse;
|
import org.jclouds.ssh.ExecResponse;
|
||||||
import org.jclouds.util.Utils;
|
import org.jclouds.util.Utils;
|
||||||
|
@ -175,9 +174,6 @@ public class BaseComputeService implements ComputeService {
|
||||||
throws RunNodesException {
|
throws RunNodesException {
|
||||||
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
||||||
checkNotNull(template.getLocation(), "location");
|
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,
|
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
|
count > 1 ? "s" : "", tag, template.getLocation().getId(), template.getImage().getId(), template
|
||||||
.getHardware().getId(), template.getOptions());
|
.getHardware().getId(), template.getOptions());
|
||||||
|
|
|
@ -55,6 +55,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
|
||||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
import org.jclouds.compute.util.ComputeServiceUtils.SshCallable;
|
import org.jclouds.compute.util.ComputeServiceUtils.SshCallable;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.scriptbuilder.InitBuilder;
|
||||||
import org.jclouds.scriptbuilder.domain.AuthorizeRSAPublicKey;
|
import org.jclouds.scriptbuilder.domain.AuthorizeRSAPublicKey;
|
||||||
import org.jclouds.scriptbuilder.domain.InstallRSAPrivateKey;
|
import org.jclouds.scriptbuilder.domain.InstallRSAPrivateKey;
|
||||||
import org.jclouds.scriptbuilder.domain.Statement;
|
import org.jclouds.scriptbuilder.domain.Statement;
|
||||||
|
@ -144,8 +145,11 @@ public class ComputeUtils {
|
||||||
bootstrap.add(options.getRunScript());
|
bootstrap.add(options.getRunScript());
|
||||||
if (options.getPrivateKey() != null)
|
if (options.getPrivateKey() != null)
|
||||||
bootstrap.add(new InstallRSAPrivateKey(options.getPrivateKey()));
|
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);
|
runScriptOnNode(node, bootstrap.size() == 1 ? bootstrap.get(0) : new StatementList(bootstrap), options);
|
||||||
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue