To use this function add it to the class library file named vCloudService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: vCloudService.ts
Description: Orchestrator Function wait for a vCloud task to complete
Function serverFindAllForType
privateWaitForVclTask(objVclTask:VclTask,intPollRate:number=1):void{
if (objVclTask!=null){
while (true){
try{
objVclTask.updateInternalState();
}
catch (objException){
this.objLogger.info(objException.description);
}
if (objVclTask.status===VclTaskStatusType.SUCCESS){
break;
}
elseif (objVclTask.status===VclTaskStatusType.CANCELED){
throw"===== Task"+objVclTask.name+" has been CANCELLED";
}
elseif (objVclTask.status===VclTaskStatusType.ABORTED){
throw"===== Task"+objVclTask.name+" has been ABORTED";
}
elseif (objVclTask.status===VclTaskStatusType.ERROR&&objVclTask.error===null){
throw"===== Task"+objVclTask.name+" has an unknown ERROR";
}
elseif (objVclTask.status===VclTaskStatusType.ERROR&&objVclTask.error!==null){
throw"===== Task"+objVclTask.name+" has an ERROR:"+objVclTask.error;
}
System.sleep(intPollRate*1000);
}
}
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
