in src/PatchOrchestrationApplication/NodeAgentSFUtility/src/CommandProcessor.cs [238:323]
public async Task<NodeAgentSfUtilityExitCodes> UpdateSearchAndDownloadStatusAsync(String nodeName, Uri applicationName,
NodeAgentSfUtilityExitCodes updateState,WindowsUpdateOperationResult operationResult, int installationTimeout, TimeSpan timeout, CancellationToken cancellationToken)
{
String taskDescription = null;
String resultDetails = null;
NodeAgentSfUtilityExitCodes result;
ExecutorDataForRmTask executorData = new ExecutorDataForRmTask()
{
ExecutorSubState = updateState,
ExecutorTimeoutInMinutes = installationTimeout
};
if (null != operationResult)
{
int succeededOperations;
int abortedOperations;
int totalOperations;
this.GetWuOperationResultCount(operationResult, out totalOperations, out abortedOperations,
out succeededOperations);
result = await
CoordinatorServiceHelper.UpdateWuOperationResult(
this.fabricClient,
applicationName,
operationResult,
timeout,
cancellationToken);
if (result != NodeAgentSfUtilityExitCodes.Success)
{
return result;
}
taskDescription =
String.Format(
"{0} updates successfully downloaded on {1}. Creating this repair task to install the downloaded updates",
succeededOperations, operationResult.OperationTime);
resultDetails =
String.Format("{0} updates searched. {1} downloaded successfully, {2} downloads were aborted",
operationResult.UpdateDetails.Count, succeededOperations, abortedOperations);
}
switch (updateState)
{
case NodeAgentSfUtilityExitCodes.DownloadCompleted:
{
result = await
RepairManagerHelper.CreateRepairTaskForNode(
this.fabricClient,
nodeName,
taskDescription,
resultDetails,
executorData,
timeout,
cancellationToken);
break;
}
case NodeAgentSfUtilityExitCodes.OperationCompleted:
{
result = NodeAgentSfUtilityExitCodes.Success;
break;
}
case NodeAgentSfUtilityExitCodes.OperationAborted:
{
ServiceEventSource.Current.InfoMessage(String.Format("Operation aborted for a claimed task"));
result = await RepairManagerHelper.UpdateRepairTask(this.fabricClient, nodeName,
RepairTaskState.Completed, RepairTaskResult.Failed,
"Aborting the operation", updateState, timeout, cancellationToken);
break;
}
default:
{
ServiceEventSource.Current.ErrorMessage(
String.Format("UpdateSearchAndDownloadStatusAsync called with invalid state {0}", updateState));
result = NodeAgentSfUtilityExitCodes.InvalidArgument;
break;
}
}
ServiceEventSource.Current.InfoMessage("UpdateSearchAndDownloadStatusAsync result = {0}", result);
return result;
}