You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/09/12 08:43:29 UTC
[11/41] 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/acd08e61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/acd08e61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/acd08e61
Branch: refs/heads/4.0
Commit: acd08e61e6ba2167a17143de8d5664f1e365ddba
Parents: 6949b40
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Sep 11 14:33:39 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Sep 11 14:37:25 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/acd08e61/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/acd08e61/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