allow search by short name for others vms. if a search for a single VM yields more than one record, fail. (for saftey, this is used for vm deletion)
This commit is contained in:
Родитель
14e05b31a8
Коммит
4e25a8468b
10
lib/vm.js
10
lib/vm.js
|
@ -89,17 +89,17 @@ function findInstance(r, name) {
|
|||
var x;
|
||||
try {
|
||||
x = jsel.match('object:has(:root > .instanceId:val(?))', [name], r);
|
||||
if (x.length) return x[0];
|
||||
if (x.length === 1) return x[0];
|
||||
} catch(e) {}
|
||||
|
||||
// is what the human typed in the vm "short name" ?
|
||||
var fn = process.env.USER + "'s awsbox deployment (" + name + ")";
|
||||
x = jsel.match('object:has(:root > .fullName:val(?))', [ fn ], r);
|
||||
if (x.length) return x[0];
|
||||
var fn = "awsbox deployment (" + name + ")";
|
||||
x = jsel.match('object:has(:root > .fullName:contains(?))', [ fn ], r);
|
||||
if (x.length === 1) return x[0];
|
||||
|
||||
// or did the human type in the full name?
|
||||
x = jsel.match('object:has(:root > .fullName:val(?))', [ name ], r);
|
||||
if (x.length) return x[0];
|
||||
if (x.length === 1) return x[0];
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче