To use this function add it to the class library file named OrchestratorService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: OrchestratorService.ts
Description: Orchestrator Function to Wait for a vSphere Replication Task to Complete
Private Function: waitVRTaskEnd
privatewaitVRTaskEnd(objVRTask:VRTask):void{
while (objVRTask!=null){
letstrName:string=objVRTask.name!=null?"'"+objVRTask.name+"'":"";
letstrState:string=objVRTask.getState();
if (strState=="success"){
this.objLogger.info("Task"+strName+"succeeded");
break;
}
elseif (strState=="error"){
throw"Task"+strName+"error:"+objVRTask.getErrotMessage();
}
elseif (strState=="running"){
if (objVRTask.getProgress()!=null){
this.objLogger.info("Task"+strName+objVRTask.getProgress()+"%");
}
else{
this.objLogger.info("Task"+strName+"in progress");
}
}
elseif (strState=="queued"){
this.objLogger.info("Task"+strName+"is queued");
}
System.sleep(500);
}
if (objVRTask==null){
throw"VRTask Task is null";
}
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
