From 4a98cbc2f8274cdd53683f8da5fa54841c8c7375 Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel <lloyd@hilaiel.com> Date: Sat, 28 Jan 2012 15:52:00 -0700 Subject: [PATCH] (aws deploy) command only displays running instances --- scripts/deploy/vm.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/deploy/vm.js b/scripts/deploy/vm.js index 9c2600db9..00ddaa922 100644 --- a/scripts/deploy/vm.js +++ b/scripts/deploy/vm.js @@ -19,11 +19,12 @@ function extractInstanceDeets(horribleBlob) { exports.list = function(cb) { aws.call('DescribeInstances', {}, function(result) { - console.log(JSON.stringify(result, null, 2)); var instances = []; - jsel.forEach(".instancesSet > .item", result, function(item) { - instances.push(extractInstanceDeets(item)); - }); + jsel.forEach( + '.instancesSet > .item:has(.instanceState .name:val("running"))', + result, function(item) { + instances.push(extractInstanceDeets(item)); + }); cb(null, instances); }); }; @@ -32,7 +33,7 @@ function returnSingleImageInfo(result, cb) { if (!result) return cb('no results from ec2 api'); try { return cb(result.Errors.Error.Message); } catch(e) {}; try { - result = jsel.match(".instancesSet > .item", result)[0]; + result = jsel.match('.instancesSet > .item', result)[0]; cb(null, extractInstanceDeets(result)); } catch(e) { return cb("couldn't extract new instance details from ec2 response: " + e); -- GitLab