summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.gateway
diff options
context:
space:
mode:
authorShireesh Anjal <anjalshireesh@gmail.com>2011-08-04 06:32:39 -0700
committerShireesh Anjal <anjalshireesh@gmail.com>2011-08-04 06:32:39 -0700
commit4c71d851c5d773375c6a67cdcf4c3f03a207bedb (patch)
tree190acad118607651586852ea5e91e1d57a23449e /src/com.gluster.storage.management.gateway
parent81f099bec13eaf3cfcad6132128e6f99d7b19e68 (diff)
parenta1b08960d702da1fd46bd662c9a44e7e2599d001 (diff)
Merge pull request #194 from Selvasundaram/master
Bug 3330 - Once volume creation fails the creation dialog should stay on the screen -fix
Diffstat (limited to 'src/com.gluster.storage.management.gateway')
-rw-r--r--src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/KeysResource.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/KeysResource.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/KeysResource.java
index 34dad497..648de3f6 100644
--- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/KeysResource.java
+++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/KeysResource.java
@@ -62,33 +62,33 @@ public class KeysResource extends AbstractResource {
}
private String createSskKeyZipFile() {
- String targetDir = System.getProperty("java.io.tmpdir");
- String zipFile = targetDir + "ssh-keys.tar";
- String sourcePemFile = SshUtil.PRIVATE_KEY_FILE.getAbsolutePath();
- String sourcePubKeyFile = SshUtil.PUBLIC_KEY_FILE.getAbsolutePath();
- String targetPemFile = targetDir + File.separator + SshUtil.PRIVATE_KEY_FILE.getName();
+ String targetDir = FileUtil.getTempDirName();
+ String zipFile = targetDir + File.separator + "ssh-keys.tar";
+ String sourcePrivateKeyFile = SshUtil.PRIVATE_KEY_FILE.getAbsolutePath();
+ String sourcePublicKeyFile = SshUtil.PUBLIC_KEY_FILE.getAbsolutePath();
+ String targetPrivateKeyFile = targetDir + File.separator + SshUtil.PRIVATE_KEY_FILE.getName();
String targetPubKeyFile = targetDir + File.separator + SshUtil.PUBLIC_KEY_FILE.getName();
if (!SshUtil.PRIVATE_KEY_FILE.isFile()) {
- throw new GlusterRuntimeException("No private key file [" + SshUtil.PRIVATE_KEY_FILE.getName() + "] found!" );
+ throw new GlusterRuntimeException("No private key file [" + SshUtil.PRIVATE_KEY_FILE.getName() + "] found!");
}
if (!SshUtil.PUBLIC_KEY_FILE.isFile()) {
- throw new GlusterRuntimeException("No public key file [" + SshUtil.PUBLIC_KEY_FILE.getName() + "] found!" );
+ throw new GlusterRuntimeException("No public key file [" + SshUtil.PUBLIC_KEY_FILE.getName() + "] found!");
}
// Copy keys to temp folder
- ProcessResult result = processUtil.executeCommand("cp", sourcePemFile, targetPemFile);
+ ProcessResult result = processUtil.executeCommand("cp", sourcePrivateKeyFile, targetPrivateKeyFile);
if (!result.isSuccess()) {
throw new GlusterRuntimeException("Failed to copy key files! [" + result.getOutput() + "]");
}
- result = processUtil.executeCommand("cp", sourcePubKeyFile, targetPubKeyFile);
+ result = processUtil.executeCommand("cp", sourcePublicKeyFile, targetPubKeyFile);
if (!result.isSuccess()) {
throw new GlusterRuntimeException("Failed to copy key files! [" + result.getOutput() + "]");
}
// To compress the key files
- result = processUtil.executeCommand("tar", "cvf", zipFile, "-C", "/tmp", SshUtil.PRIVATE_KEY_FILE.getName(),
+ result = processUtil.executeCommand("tar", "cvf", zipFile, "-C", targetDir, SshUtil.PRIVATE_KEY_FILE.getName(),
SshUtil.PUBLIC_KEY_FILE.getName());
if (!result.isSuccess()) {
throw new GlusterRuntimeException("Failed to compress key files! [" + result.getOutput() + "]");
@@ -96,7 +96,7 @@ public class KeysResource extends AbstractResource {
// To remove the copied key files
try {
- processUtil.executeCommand("rm", "-f", targetPemFile, targetPubKeyFile); // Ignore the errors if any
+ processUtil.executeCommand("rm", "-f", targetPrivateKeyFile, targetPubKeyFile); // Ignore the errors if any
} catch (Exception e) {
logger.warn(e.toString());
}
@@ -111,10 +111,10 @@ public class KeysResource extends AbstractResource {
writeToFile(uploadedInputStream, uploadedFile.getAbsolutePath());
- // To backup existing SSH pem and public keys, if exist.
+ // To backup existing SSH private and public keys, if exist.
if (SshUtil.PRIVATE_KEY_FILE.isFile()) {
if (!SshUtil.PRIVATE_KEY_FILE.renameTo(new File(SshUtil.PRIVATE_KEY_FILE.getAbsolutePath() + "-" + timestamp))) {
- throw new GlusterRuntimeException("Unable to backup pem key!");
+ throw new GlusterRuntimeException("Unable to backup private key!");
}
}
@@ -124,7 +124,7 @@ public class KeysResource extends AbstractResource {
throw new GlusterRuntimeException("Unable to backup public key!");
}
}
- // Extract SSH pem and public key files.
+ // Extract SSH private and public key files.
ProcessResult output = processUtil.executeCommand("tar", "xvf", uploadedFile.getName(), "-C",
SshUtil.SSH_AUTHORIZED_KEYS_DIR_LOCAL);
uploadedFile.delete();