You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by as...@apache.org on 2011/04/14 08:46:29 UTC
svn commit: r1092018 - in /incubator/whirr/trunk: CHANGES.txt
core/src/main/java/org/apache/whirr/ClusterSpec.java
Author: asavu
Date: Thu Apr 14 06:46:29 2011
New Revision: 1092018
URL: http://svn.apache.org/viewvc?rev=1092018&view=rev
Log:
WHIRR-269. Improve error msg "Key pair is encrypted" (tomwhite via asavu)
Modified:
incubator/whirr/trunk/CHANGES.txt
incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java
Modified: incubator/whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/CHANGES.txt?rev=1092018&r1=1092017&r2=1092018&view=diff
==============================================================================
--- incubator/whirr/trunk/CHANGES.txt (original)
+++ incubator/whirr/trunk/CHANGES.txt Thu Apr 14 06:46:29 2011
@@ -27,6 +27,8 @@ Trunk (unreleased changes)
org.apache.whirr.actions.
(tomwhite)
+ WHIRR-269. Improve error msg "Key pair is encrypted" (tomwhite via asavu)
+
BUG FIXES
WHIRR-253. ZooKeeper service should only authorize ingress to ZooKeeper
Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java?rev=1092018&r1=1092017&r2=1092018&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterSpec.java Thu Apr 14 06:46:29 2011
@@ -307,6 +307,7 @@ public class ClusterSpec {
}
private void checkAndSetKeyPair() throws ConfigurationException {
+ String pairRepresentation = "";
try {
String privateKeyPath = getString(Property.PRIVATE_KEY_FILE);
@@ -314,26 +315,33 @@ public class ClusterSpec {
publicKeyPath = (publicKeyPath == null && privateKeyPath != null) ?
privateKeyPath + ".pub" : publicKeyPath;
if(privateKeyPath != null && publicKeyPath != null) {
+ pairRepresentation = "(" + privateKeyPath + ", " +
+ publicKeyPath + ")";
KeyPair pair = KeyPair.load(new JSch(), privateKeyPath, publicKeyPath);
if (pair.isEncrypted()) {
- throw new ConfigurationException("Key pair is encrypted");
+ throw new ConfigurationException("Key pair " + pairRepresentation +
+ " is encrypted. Try generating a new passwordless SSH keypair " +
+ "(e.g. with ssh-keygen).");
}
if (!sameKeyPair(new File(privateKeyPath), new File(publicKeyPath))) {
throw new ConfigurationException("Both keys should belong " +
- "to the same key pair");
+ "to the same key pair: " + pairRepresentation);
}
setPrivateKey(new File(privateKeyPath));
setPublicKey(new File(publicKeyPath));
}
} catch (JSchException e) {
- throw new ConfigurationException("Invalid key pair", e);
+ throw new ConfigurationException("Invalid key pair: " +
+ pairRepresentation, e);
} catch (IllegalArgumentException e) {
- throw new ConfigurationException("Invalid key", e);
+ throw new ConfigurationException("Invalid key: " +
+ pairRepresentation, e);
} catch (IOException e) {
- throw new ConfigurationException("Error reading one of key file", e);
+ throw new ConfigurationException("Error reading one of key file: " +
+ pairRepresentation, e);
}
}