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
private waitVRTaskEnd(objVRTask: VRTask): void {
while (objVRTask != null) {
let strName: string = objVRTask.name != null ? "'" + objVRTask.name + "' " : "";
let strState: string = objVRTask.getState();
if (strState == "success") {
this.objLogger.info("Task " + strName + "succeeded");
break;
}
else if (strState == "error") {
throw "Task " + strName + "error: " + objVRTask.getErrotMessage();
}
else if (strState == "running") {
if (objVRTask.getProgress() != null) {
this.objLogger.info("Task " + strName + objVRTask.getProgress() + "%");
}
else {
this.objLogger.info("Task " + strName + "in progress");
}
}
else if (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.
