Skip to content
This repository
Browse code

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

…known or nonexistent
  • Loading branch information...
commit d7e4736d3cc1c78af68303eab1737c49874f1d48 1 parent 67c3e04
Tim Freeman timf authored
15 service/client/java/source/src/org/globus/workspace/cloud/client/CloudClient.java
@@ -708,6 +708,10 @@ void _parameterCheck_clusterfile() throws ParameterProblem {
708 708 boolean adjustKnownHosts = false;
709 709
710 710 String ssh_hostsfile = this.args.getSsh_hostsfile();
  711 + if (ssh_hostsfile == null) {
  712 + this.print.errln("Your SSH known_hosts file will not be updated with " +
  713 + "generated keys (see cloud.properties to enable).");
  714 + }
711 715
712 716 for (int i = 0; i < this.clusterMembers.length; i++) {
713 717
@@ -1633,9 +1637,14 @@ void action_run_cluster() throws ExecutionProblem, ExitNow {
1633 1637 printNames[i] = member.getPrintName(); // may be null
1634 1638 }
1635 1639
1636   - final KnownHostsTask[] knownHostTasks =
1637   - ClusterUtil.constructKnownHostTasks(this.clusterMembers,
1638   - this.args.isHostkeyDir());
  1640 + final KnownHostsTask[] knownHostTasks;
  1641 + if (this.args.getSsh_hostsfile() != null) {
  1642 + knownHostTasks =
  1643 + ClusterUtil.constructKnownHostTasks(this.clusterMembers,
  1644 + this.args.isHostkeyDir());
  1645 + } else {
  1646 + knownHostTasks = null;
  1647 + }
1639 1648
1640 1649 this.executeUtil.startWorkspaceCluster(this.workspaceFactoryURL,
1641 1650 knownHostTasks,
12 service/client/java/source/src/org/globus/workspace/cloud/client/tasks/ContextMonitorTask.java
@@ -35,7 +35,7 @@
35 35 private final long pollMs;
36 36 private final String knownHostsFile;
37 37 private String knownHostsDir;
38   - private final String knownHostsTasks;
  38 + private final String knownHostsTasksStr;
39 39
40 40 private final Print pr;
41 41
@@ -60,7 +60,7 @@ public ContextMonitorTask(String ctxEprPath,
60 60 if (knownHostTasks == null || knownHostTasks.length == 0) {
61 61
62 62 this.knownHostsFile = null;
63   - this.knownHostsTasks = null;
  63 + this.knownHostsTasksStr = null;
64 64 this.knownHostsDir = null;
65 65
66 66 } else {
@@ -99,10 +99,10 @@ public ContextMonitorTask(String ctxEprPath,
99 99 }
100 100 }
101 101
102   - this.knownHostsTasks = buf.toString();
  102 + this.knownHostsTasksStr = buf.toString();
103 103 }
104 104
105   - if (this.knownHostsTasks != null) {
  105 + if (this.knownHostsTasksStr != null) {
106 106 if (this.knownHostsFile == null && this.knownHostsDir == null) {
107 107 throw new ExecutionProblem("known-host tasks " +
108 108 "but no path/dir to adjust");
@@ -149,13 +149,13 @@ int execute() {
149 149 cmdList.add(this.name);
150 150 }
151 151
152   - if (this.knownHostsTasks != null) {
  152 + if (this.knownHostsTasksStr != null) {
153 153 if (this.knownHostsFile != null) {
154 154 cmdList.add("--" + Opts.SSHHOSTS_OPT_STRING);
155 155 cmdList.add(this.knownHostsFile);
156 156 }
157 157 cmdList.add("--" + Opts.ADJUST_SSHHOSTS_OPT_STRING);
158   - cmdList.add(this.knownHostsTasks);
  158 + cmdList.add(this.knownHostsTasksStr);
159 159 if (this.knownHostsDir != null) {
160 160 cmdList.add("--" + Opts.SSHHOSTSDIR_OPT_STRING);
161 161 cmdList.add(this.knownHostsDir);
11 service/client/java/source/src/org/globus/workspace/cloud/client/util/ExecuteUtil.java
@@ -31,8 +31,8 @@
31 31 import org.globus.workspace.client_core.utils.FileUtils;
32 32 import org.globus.workspace.client_core.utils.StringUtils;
33 33 import org.globus.workspace.cloud.client.Opts;
34   -import org.globus.workspace.cloud.client.cluster.KnownHostsTask;
35 34 import org.globus.workspace.cloud.client.cluster.ClusterMember;
  35 +import org.globus.workspace.cloud.client.cluster.KnownHostsTask;
36 36 import org.globus.workspace.cloud.client.tasks.ClusterDoneTask;
37 37 import org.globus.workspace.cloud.client.tasks.ClusterMonitorTask;
38 38 import org.globus.workspace.cloud.client.tasks.ContextMonitorTask;
@@ -46,7 +46,6 @@
46 46 import org.globus.workspace.common.client.CommonPrint;
47 47 import org.globus.workspace.common.print.Print;
48 48 import org.globus.workspace.common.print.PrintOpts;
49   -import org.globus.wsrf.encoding.SerializationException;
50 49 import org.nimbustools.ctxbroker.generated.gt4_0.description.BrokerContactType;
51 50 import org.nimbustools.ctxbroker.generated.gt4_0.description.Cloudcluster_Type;
52 51 import org.nimbustools.ctxbroker.generated.gt4_0.description.Nimbusctx_Type;
@@ -58,7 +57,6 @@
58 57 import java.io.File;
59 58 import java.io.FilenameFilter;
60 59 import java.io.PrintStream;
61   -import java.io.IOException;
62 60 import java.net.MalformedURLException;
63 61 import java.net.URL;
64 62 import java.util.ArrayList;
@@ -897,9 +895,14 @@ public void startWorkspaceCluster(String workspaceFactoryURL,
897 895
898 896 // find specific EPR IPs in order to key the known_hosts request
899 897 // correctly.
900   - final KnownHostsTask[] sendTasks =
  898 + final KnownHostsTask[] sendTasks;
  899 + if (knownHostTasks != null) {
  900 + sendTasks =
901 901 hostTaskIDs(knownHostTasks, allEPRpaths,
902 902 print, eprIdIpDirPath, knownHostsDirPath);
  903 + } else {
  904 + sendTasks = null;
  905 + }
903 906
904 907 final long ctx_start = System.currentTimeMillis();
905 908

0 comments on commit d7e4736

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