You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/09/12 02:38:57 UTC

[9/50] [abbrv] git commit: CS-16239: don't try to pull key information if the key was removed in the system

CS-16239: don't try to pull key information if the key was removed in the system

As a part of the commit, also checking deleteSshKeyPair name - admin was unable to delete the key on behalf of another user

Conflicts:

	server/src/com/cloud/api/ApiDBUtils.java


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/4a8ffe34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/4a8ffe34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/4a8ffe34

Branch: refs/heads/javelin
Commit: 4a8ffe34e2e23ee84b9ae719d11959f4dff1b64b
Parents: df7069d
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Sep 11 14:33:39 2012 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Tue Sep 11 17:38:24 2012 -0700

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiDBUtils.java           |    6 +++++-
 .../src/com/cloud/server/ManagementServerImpl.java |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4a8ffe34/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index 55c8671..7126931 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -814,7 +814,11 @@ public class ApiDBUtils {
 
     public static String getKeyPairName(String sshPublicKey) {
         SSHKeyPairVO sshKeyPair = _sshKeyPairDao.findByPublicKey(sshPublicKey);
-        return sshKeyPair.getName();
+        //key might be removed prior to this point
+        if (sshKeyPair != null) {
+            return sshKeyPair.getName();
+        }
+        return null;
     }
 
     public static UserVmDetailVO  findPublicKeyByVmId(long vmId) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4a8ffe34/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 9cd2b48..4f489bc 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -3298,7 +3298,7 @@ public class ManagementServerImpl implements ManagementServer {
             throw ex;
         }
 
-        return _sshKeyPairDao.deleteByName(caller.getAccountId(), caller.getDomainId(), cmd.getName());
+        return _sshKeyPairDao.deleteByName(owner.getAccountId(), owner.getDomainId(), cmd.getName());
     }
 
     @Override