Skip to content

feat(glsh): show response body on curl failure

What

Update the --fail to --fail-with-body

This is an alternative option to -f, --fail which makes curl fail for the same circumstances but without saving the content.

https://curl.se/docs/manpage.html

Before:

$ glsh gitaly repositories move -e gstg gitlab-qa-user2/parent-project-d1cd4dc5232ef03c
This script requires an personal access token with admin API access.
Create a new one by:
 - Logging into GitLab with an admin account
 - Visit https://staging.gitlab.com/-/profile/personal_access_tokens
 - Create a new token by selecting 'Add a new token' with API access

enter token value:

Moving the following projects to any storage that is available
  gitlab-qa-user2/parent-project-d1cd4dc5232ef03c
    getting info...[current_storage=nfs-file07]
    moving...✘ curl exited non-zero!
        curl: (22) The requested URL returned error: 400

After:

$ glsh gitaly repositories move -e gstg gitlab-qa-user2/parent-project-d1cd4dc5232ef03c
This script requires an personal access token with admin API access.
Create a new one by:
 - Logging into GitLab with an admin account
 - Visit https://staging.gitlab.com/-/profile/personal_access_tokens
 - Create a new token by selecting 'Add a new token' with API access

enter token value:

Moving the following projects to any storage that is available
  gitlab-qa-user2/parent-project-d1cd4dc5232ef03c
    getting info...[current_storage=nfs-file07]
    moving...✘ curl exited non-zero!
        curl: (22) The requested URL returned error: 400
{"message":{"project":["is read-only"]}}

Why

Just showing the status code is not clear enough, because we don't show the reason why it failed

Signed-off-by: Steve Xuereb sxuereb@gitlab.com

Merge request reports