mirror of https://github.com/apache/cloudstack.git
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
This commit is contained in:
parent
df7069d771
commit
4a8ffe34e2
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue