feat(task-service)!: add spec compliant task service support#107
feat(task-service)!: add spec compliant task service support#107jayzhudev wants to merge 4 commits into
Conversation
Adding this support for RMS firmware upload status checks. Signed-off-by: Jay Zhu <jayzhu@nvidia.com>
dbf067b to
8843eb4
Compare
Signed-off-by: Jay Zhu <jayzhu@nvidia.com>
7d49e50 to
815cfe1
Compare
| /// # Errors | ||
| /// | ||
| /// Returns error if retrieving task data fails. | ||
| pub async fn task(&self, task_path: impl ToString) -> Result<Arc<Task>, Error<B>> { |
There was a problem hiding this comment.
If I understand correctly then it is from Location header from the result of the operation. It would be nice to:
- Introduce type for a Location header value
- Use it here and task service should check that Location header value corresponds to its own odata.id.
This will express additional knowledge trough type system and better errors if somebody by mistake will use task service for non-task values (I think some vendors may have their own async job services, see Dell OEM jobs for example).
There was a problem hiding this comment.
Maybe we also should add separate function that can check that Location is valid Task resource.
There was a problem hiding this comment.
This is a very good and thoughtful call, thanks!
After some thinking, I see two options here:
-
add a Location type. The intent is clearer to the caller but it wouldn't prevent caller mistakes of calling a wrong task service instance - we would still need validation in
taskcalling. -
keep the API simple and only add validation inside TaskService::task(). The caller passes the task path, and TaskService checks it is under the BMC's Tasks collection before polling.
Option 2 seems to have the right tradeoff to me because the validation is task-specific, and TaskService already has the Tasks collection needed to do it.
Signed-off-by: Jay Zhu <jayzhu@nvidia.com>
Signed-off-by: Jay Zhu <jayzhu@nvidia.com>
Adding this support for RMS firmware upload status checks.
Breaking change:
task-servicefeature is enabled, the redfish::Error now has 2 new variants.