Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve osc_sdk oAPI error management #61

Open
outscale-dta opened this issue Jan 29, 2021 · 0 comments
Open

Improve osc_sdk oAPI error management #61

outscale-dta opened this issue Jan 29, 2021 · 0 comments

Comments

@outscale-dta
Copy link

Context:

Oapi does not give all the informations on error like aws-cli or osc-cli does even though we need it.

Problem:

Error code AWS Ec2

Command used:

aws ec2 --profile test --endpoint http://x.x.x.x delete-volume --volume-id vol-12345678

Error sent:

An error occurred (InvalidVolume.NotFound) when calling the DeleteVolume operation: The volume 'Vol-12345678' does not exist.

Observations:

We do get an error code (InvalidVolume.NotFound) with a message (The volume 'Vol-12345678' does not exist.) as expected.

Error code OSC_CLI FLU

Command used:

osc-cli fcu --profile pdka1fcu DeleteVolume --VolumeId vol-12345678

Error sent:

Error --> status = 400, code = InvalidVolume.NotFound, Reason = The volume 'vol-12345678' does not exist., request_id = 0242e490-a48b-462e-810b-61f708e51606

Observations:

For the same call as before we get the same type of error mapping than with aws ec2 with an error code (InvalidVolume.NotFound) along with a message (The volume 'vol-12345678' does not exist.)

Error code Oapi:

Command used:

osc-cli api --profile pdka1 DeleteVolume --VolumeId vol-12345678

Error sent:

Error --> status = 400, code = 5064, Reason = InvalidResource, request_id = 5c487069-04b5-488b-9fc9-98c7049e89f6

Observations:

In this case, we do find the same type of informations than previous calls, however, the actual content is different since we get a number as the error code (5064) and the message is short and not very informative. We could add another field to the mapping which will give a longer description and thus, more informations as to what exactly failed in the call. There's also the possibility of mapping the "Reason" field so that "InvalidResource" get replaced by a more useful message.

Internal response format before osc_sdk parsing

Error sent:

"Errors":[{"Code":"5064","Details":"The VolumeId 'Vol-12345678' doesn't exist.","Type":"InvalidResource"}]

Observations:

Here we get a number as the error code (5064) but also what we could have expected for Oapi, a short error message (InvalidResource) with another field containing a more detailed description of the error (The VolumeId 'Vol-12345678' doesn't exist.)

Solution(s):

I propose to map the Details with the Reason for oAPI and add a new field as CodeType to put the old Reason (as InvalidRessource)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant