Author: adietish
Date: 2012-04-30 11:19:06 -0400 (Mon, 30 Apr 2012)
New Revision: 40647
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
Log:
[JBIDE-11715] adding key to OpenShift when creating a domain. Storing new key with a
default name "jbosstools"
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30
14:27:39 UTC (rev 40646)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30
15:19:06 UTC (rev 40647)
@@ -29,8 +29,11 @@
import com.openshift.client.IDomain;
import com.openshift.client.IEmbeddableCartridge;
import com.openshift.client.IGearProfile;
+import com.openshift.client.IOpenShiftSSHKey;
+import com.openshift.client.ISSHPublicKey;
import com.openshift.client.IUser;
import com.openshift.client.OpenShiftException;
+import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
public class UserDelegate {
private IUser delegate;
@@ -232,4 +235,13 @@
public void setConnected(boolean connected) {
this.connected = connected;
}
+
+ public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey) throws
SocketTimeoutException, OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
+ return delegate.getSSHKeyByPublicKey(publicKey);
+ }
+
+ public IOpenShiftSSHKey putSSHKey(String name, ISSHPublicKey key) throws
OpenShiftException, SocketTimeoutException {
+ return delegate.putSSHKey(name, key);
+ }
+
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30
14:27:39 UTC (rev 40646)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30
15:19:06 UTC (rev 40647)
@@ -22,6 +22,7 @@
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
import com.openshift.client.IDomain;
+import com.openshift.client.IOpenShiftSSHKey;
import com.openshift.client.ISSHPublicKey;
import com.openshift.client.OpenShiftException;
import com.openshift.client.SSHKeyPair;
@@ -35,6 +36,8 @@
public static final String LIBRA_KEY = "libra_id_rsa";
private static final String PUBLIC_KEY_SUFFIX = ".pub";
+ private static final String SSHKEY_DEFAULT_NAME = "jbosstools"; //$NON-NLS-1$
+
public static final String PROPERTY_DOMAIN_ID = "domainId";
public static final String PROPERTY_SSHKEY = "sshKey";
@@ -99,7 +102,12 @@
}
public void createDomain() throws OpenShiftException, IOException {
- IDomain domain = user.createDomain(domainId);
+ user.createDomain(domainId);
+ ISSHPublicKey sshKey = loadSshKey();
+ IOpenShiftSSHKey sshKeyResource = user.getSSHKeyByPublicKey(sshKey.getPublicKey());
+ if (sshKeyResource == null) {
+ user.putSSHKey(SSHKEY_DEFAULT_NAME, sshKey);
+ }
}
public String getSshKey() {
Show replies by date