summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/KeysResource.java28
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/CreateVolumeWizard.java1
2 files changed, 15 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();
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/CreateVolumeWizard.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/CreateVolumeWizard.java
index 0d8104bb..287be661 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/CreateVolumeWizard.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/CreateVolumeWizard.java
@@ -57,6 +57,7 @@ public class CreateVolumeWizard extends Wizard {
handlePartSuccess(newVolume, volumesClient, errMsg);
} else {
MessageDialog.openError(getShell(), title, "Volume creation failed! Error: " + errMsg);
+ return false;
}
}