mirror of https://github.com/apache/cloudstack.git
Adds support for keyword search that was ignored by listsshkeypairs command. Fixes: #2920
This commit is contained in:
parent
8d53557ba7
commit
a7ccbdc790
|
|
@ -3655,6 +3655,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
public Pair<List<? extends SSHKeyPair>, Integer> listSSHKeyPairs(final ListSSHKeyPairsCmd cmd) {
|
||||
final String name = cmd.getName();
|
||||
final String fingerPrint = cmd.getFingerprint();
|
||||
final String keyword = cmd.getKeyword();
|
||||
|
||||
final Account caller = getCaller();
|
||||
final List<Long> permittedAccounts = new ArrayList<Long>();
|
||||
|
|
@ -3681,6 +3682,11 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
sc.addAnd("fingerprint", SearchCriteria.Op.EQ, fingerPrint);
|
||||
}
|
||||
|
||||
if (keyword != null) {
|
||||
sc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
sc.addOr("fingerprint", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
}
|
||||
|
||||
final Pair<List<SSHKeyPairVO>, Integer> result = _sshKeyPairDao.searchAndCount(sc, searchFilter);
|
||||
return new Pair<List<? extends SSHKeyPair>, Integer>(result.first(), result.second());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue