Skip to content
Browse files

Fix for Bug 7004: Cloud client fails late when known_hosts file is un…

…known or nonexistent
  • Loading branch information...
1 parent 67c3e04 commit d7e4736d3cc1c78af68303eab1737c49874f1d48 @timf timf committed Jun 15, 2010
View
15 service/client/java/source/src/org/globus/workspace/cloud/client/CloudClient.java
@@ -708,6 +708,10 @@ void _parameterCheck_clusterfile() throws ParameterProblem {
boolean adjustKnownHosts = false;
String ssh_hostsfile = this.args.getSsh_hostsfile();
+ if (ssh_hostsfile == null) {
+ this.print.errln("Your SSH known_hosts file will not be updated with " +
+ "generated keys (see cloud.properties to enable).");
+ }
for (int i = 0; i < this.clusterMembers.length; i++) {
@@ -1633,9 +1637,14 @@ void action_run_cluster() throws ExecutionProblem, ExitNow {
printNames[i] = member.getPrintName(); // may be null
}
- final KnownHostsTask[] knownHostTasks =
- ClusterUtil.constructKnownHostTasks(this.clusterMembers,
- this.args.isHostkeyDir());
+ final KnownHostsTask[] knownHostTasks;
+ if (this.args.getSsh_hostsfile() != null) {
+ knownHostTasks =
+ ClusterUtil.constructKnownHostTasks(this.clusterMembers,
+ this.args.isHostkeyDir());
+ } else {
+ knownHostTasks = null;
+ }
this.executeUtil.startWorkspaceCluster(this.workspaceFactoryURL,
knownHostTasks,
View
12 ...ce/client/java/source/src/org/globus/workspace/cloud/client/tasks/ContextMonitorTask.java
@@ -35,7 +35,7 @@
private final long pollMs;
private final String knownHostsFile;
private String knownHostsDir;
- private final String knownHostsTasks;
+ private final String knownHostsTasksStr;
private final Print pr;
@@ -60,7 +60,7 @@ public ContextMonitorTask(String ctxEprPath,
if (knownHostTasks == null || knownHostTasks.length == 0) {
this.knownHostsFile = null;
- this.knownHostsTasks = null;
+ this.knownHostsTasksStr = null;
this.knownHostsDir = null;
} else {
@@ -99,10 +99,10 @@ public ContextMonitorTask(String ctxEprPath,
}
}
- this.knownHostsTasks = buf.toString();
+ this.knownHostsTasksStr = buf.toString();
}
- if (this.knownHostsTasks != null) {
+ if (this.knownHostsTasksStr != null) {
if (this.knownHostsFile == null && this.knownHostsDir == null) {
throw new ExecutionProblem("known-host tasks " +
"but no path/dir to adjust");
@@ -149,13 +149,13 @@ int execute() {
cmdList.add(this.name);
}
- if (this.knownHostsTasks != null) {
+ if (this.knownHostsTasksStr != null) {
if (this.knownHostsFile != null) {
cmdList.add("--" + Opts.SSHHOSTS_OPT_STRING);
cmdList.add(this.knownHostsFile);
}
cmdList.add("--" + Opts.ADJUST_SSHHOSTS_OPT_STRING);
- cmdList.add(this.knownHostsTasks);
+ cmdList.add(this.knownHostsTasksStr);
if (this.knownHostsDir != null) {
cmdList.add("--" + Opts.SSHHOSTSDIR_OPT_STRING);
cmdList.add(this.knownHostsDir);
View
11 service/client/java/source/src/org/globus/workspace/cloud/client/util/ExecuteUtil.java
@@ -31,8 +31,8 @@
import org.globus.workspace.client_core.utils.FileUtils;
import org.globus.workspace.client_core.utils.StringUtils;
import org.globus.workspace.cloud.client.Opts;
-import org.globus.workspace.cloud.client.cluster.KnownHostsTask;
import org.globus.workspace.cloud.client.cluster.ClusterMember;
+import org.globus.workspace.cloud.client.cluster.KnownHostsTask;
import org.globus.workspace.cloud.client.tasks.ClusterDoneTask;
import org.globus.workspace.cloud.client.tasks.ClusterMonitorTask;
import org.globus.workspace.cloud.client.tasks.ContextMonitorTask;
@@ -46,7 +46,6 @@
import org.globus.workspace.common.client.CommonPrint;
import org.globus.workspace.common.print.Print;
import org.globus.workspace.common.print.PrintOpts;
-import org.globus.wsrf.encoding.SerializationException;
import org.nimbustools.ctxbroker.generated.gt4_0.description.BrokerContactType;
import org.nimbustools.ctxbroker.generated.gt4_0.description.Cloudcluster_Type;
import org.nimbustools.ctxbroker.generated.gt4_0.description.Nimbusctx_Type;
@@ -58,7 +57,6 @@
import java.io.File;
import java.io.FilenameFilter;
import java.io.PrintStream;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -897,9 +895,14 @@ public void startWorkspaceCluster(String workspaceFactoryURL,
// find specific EPR IPs in order to key the known_hosts request
// correctly.
- final KnownHostsTask[] sendTasks =
+ final KnownHostsTask[] sendTasks;
+ if (knownHostTasks != null) {
+ sendTasks =
hostTaskIDs(knownHostTasks, allEPRpaths,
print, eprIdIpDirPath, knownHostsDirPath);
+ } else {
+ sendTasks = null;
+ }
final long ctx_start = System.currentTimeMillis();

0 comments on commit d7e4736

Please sign in to comment.
Something went wrong with that request. Please try again.