one icon indicating copy to clipboard operation
one copied to clipboard

OneFlow CLIs: document type error handling

Open 1gramos opened this issue 1 year ago • 0 comments

Description

Follow-up to https://github.com/OpenNebula/one/issues/6305, please refer to that issue for background and context.

On closer inspection, we decided that the previous issue was trickier than expected so we thought it was better to split it in two:

  • The original issue, which will be closed after applying an approximate solution that mitigates the problem
  • This issue, to discuss the problem and try to find a better solution.

In particular, the problem that we need to solve is a chicken-and-egg one. CLI tools (such as oneflow) are passed resource IDs which may or may not correspond to its given document type (for example, type 100 corresponds to oneflow instances and type 101 correspond to oneflow-templates). And, they have no way to know what type of resource it is, unless asking the OneFlow server via its REST API. But then again, they need to decide beforehand which resource to call (/service or /service_template).

Interface Changes

First, we should discuss the exact scope of the document concept, its relationship with oneflow instances and templates, whether there are or will be other document types, etc. Just in case it makes sense to expose it somehow as a first-class resource.

Then, we will probably need to add a specific error code to oneflow-server.rb (/service/* + /service_template/* endpoints) to indicate that the given ID does not correspond to that type of document.

Progress Status

  • [ ] Code committed
  • [ ] Testing - QA
  • [ ] Documentation (Release notes - resolved issues, compatibility, known issues)

1gramos avatar Jul 09 '24 14:07 1gramos