[jbosstools-commits] JBoss Tools SVN: r43917 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 21 05:20:20 EDT 2012


Author: adietish
Date: 2012-09-21 05:20:20 -0400 (Fri, 21 Sep 2012)
New Revision: 43917

Modified:
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AbstractSSHKeyWizardPageModel.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
Log:
[JBIDE-11912] implementation finished: corrected bugs with layout and validation status

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AbstractSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AbstractSSHKeyWizardPageModel.java	2012-09-21 09:10:25 UTC (rev 43916)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AbstractSSHKeyWizardPageModel.java	2012-09-21 09:20:20 UTC (rev 43917)
@@ -60,5 +60,4 @@
 		}
 		return ssh2Home;
 	}
-
 }

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java	2012-09-21 09:10:25 UTC (rev 43916)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java	2012-09-21 09:20:20 UTC (rev 43917)
@@ -15,7 +15,6 @@
 import java.io.IOException;
 
 import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
-import org.jboss.tools.openshift.express.internal.ui.utils.SSHUserConfig;
 
 import com.openshift.client.OpenShiftException;
 import com.openshift.client.SSHPublicKey;

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java	2012-09-21 09:10:25 UTC (rev 43916)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java	2012-09-21 09:20:20 UTC (rev 43917)
@@ -15,6 +15,7 @@
 import java.io.IOException;
 
 import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
 import org.jboss.tools.openshift.express.internal.ui.utils.SSHUtils;
 import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
 
@@ -108,6 +109,7 @@
 	}
 
 	private SSHKeyPair createSSHKey() {
+		ensureSSHHomeExists(ssh2Home);
 		File privateKey = new File(ssh2Home, privateKeyName);
 		File publicKey = new File(ssh2Home, publicKeyName);
 		SSHKeyPair keyPair =
@@ -116,4 +118,25 @@
 		return keyPair;
 	}
 
+	private void ensureSSHHomeExists(String ssh2Home)
+			throws OpenShiftException {
+		File ssh2HomeFile = new File(ssh2Home);
+		if (FileUtils.canRead(ssh2HomeFile)) {
+			if (!FileUtils.isDirectory(ssh2HomeFile)) {
+				throw new OpenShiftException(
+						ssh2Home + " is a file instead of a directory. This prevents creation and usage of ssh keys");
+			}
+			return;
+		}
+
+		try {
+			if(!ssh2HomeFile.mkdirs()) {
+				throw new OpenShiftException("Could not create ssh2 home directory at {0}", ssh2Home);
+			}
+		} catch(SecurityException e) {
+			throw new OpenShiftException(e, "Could not create ssh2 home directory at {0}", ssh2Home);
+		}
+	}
+
+	
 }



More information about the jbosstools-commits mailing list