From 899c2623e4fe877c46c457f19f48524771551d9a Mon Sep 17 00:00:00 2001 From: Selvasundaram Date: Thu, 4 Aug 2011 15:49:44 +0530 Subject: Bug 3239 - Not able to export the keys properly - fix --- .../gateway/resources/v1_0/KeysResource.java | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') 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(); -- cgit From a1b08960d702da1fd46bd662c9a44e7e2599d001 Mon Sep 17 00:00:00 2001 From: Selvasundaram Date: Thu, 4 Aug 2011 18:13:30 +0530 Subject: Bug 3330 - Once volume creation fails the creation dialog should stay on the screen -fix --- .../com/gluster/storage/management/gui/dialogs/CreateVolumeWizard.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src') 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; } } -- cgit