Skip to content

Commit

Permalink
fix(client): filter when the command doesn’t return a result.
Browse files Browse the repository at this point in the history
  • Loading branch information
chabou-san committed Feb 8, 2017
1 parent 3120103 commit eec5c0d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,16 @@ Client.prototype.powerOpVMByMORef = function( MORefs, powerOp ) {
self.runCommand( powerCommand, { _this: MORef })
.once('result', function(result){
var taskMORef = result.returnval;
self.waitForValues( taskMORef , ['info.state','info.error'], 'state', ['success','error'])

if (_.isEmpty(taskMORef)) {
resultArray.push( { obj: MORef, result: result['info.state'] } );
if(resultArray.length === MORefs.length) {
emitter.emit('result', resultArray);
}
return;
}

self.waitForValues(taskMORef, ['info.state', 'info.error'], 'state', ['success', 'error'])
.once('result', function( result ) {
if( result['info.error'] == undefined ) {
resultArray.push( { obj: MORef, result: result['info.state'] } );
Expand Down

0 comments on commit eec5c0d

Please sign in to comment.