Fix error creating import for unresolvable host
What does this MR do and why?
This MR fixes errors when creating an import for an unresolvable host.
When a host was unresolvable (example: http://gitlab.example
),
BulkImports::CreateService#execute
could throw an unhandled
Gitlab::HTTP::BlockedUrlError
exception.
The exception was throwable by with_error_handling
in 9a0b72ec to be able to later handle.
This change has with_error_handling
raising one exception type again, which means the calling code only needs to handle the one exception.
This change came out of this Slack thread (internal, good for 90 days), where we noticed the curl
request copied below would cause a 500
error.
How to set up and validate locally
In the following curl
request, replace <your-token>
with a PAT for your development user.
curl --request POST --header "PRIVATE-TOKEN: <your-token>" "http://gdk.test:3000/api/v4/bulk_imports" \
--header "Content-Type: application/json" \
--data '{
"configuration": {
"url": "http://gitlab.example/",
"access_token": "access_token"
},
"entities": [
{
"source_full_path": "source/full/path",
"source_type": "group_entity",
"destination_slug": "destination_slug",
"destination_namespace": "destination/namespace/path"
}
]
}'
On this branch, the response will be:
{"message":"URL is blocked: Host cannot be resolved or invalid"}
On master
, the response will be:
{"message":"500 Internal Server Error"}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.