GoogleCloudPlatform / GoogleCloudPlatform/gsutil
shim_util issue in translating "CLOUDSDK_API_ENDPOINT_OVERRIDES_STORAGE" parameter from .boto config
- Dominant language
- Python
- Stars
- 918
- Forks
- 335
- PR merge metrics
- No merged PRs in 30d
Description
.boto has entry for
[Credentials]
gs_json_host = foo.bar
[GSUtil]
use_gcloud_storage=True
running the gsutil command fails with below error:
ERROR: (gcloud.storage.ls) Invalid value for property [api_endpoint_overrides/storage]: The endpoint_overrides property must be an absolute URI beginning with http:// or https:// and ending with a trailing '/'.
PFB the debug log
`DEBUG: (gcloud.storage.ls) Invalid value for property [api_endpoint_overrides/storage]: The endpoint_overrides property must be an absolute URI beginning with http:// or https:// and ending with a trailing '/'. [https://foo.bar/storage/v1] is not a valid endpoint override.
Traceback (most recent call last):
File "/apps/opt/application/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 4147, in Validate
self.__validator(value)
File "/apps/opt/application/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 1425, in EndpointValidator
raise InvalidValueError(
googlecloudsdk.core.properties.InvalidValueError: The endpoint_overrides property must be an absolute URI beginning with http:// or https:// and ending with a trailing '/'. [https://foo.bar//storage/v1] is not a valid endpoint override.`
To Fix:
Need to add trailing "/" in the shim_util when returning the translated value
https://github.com/GoogleCloudPlatform/gsutil/blob/master/gslib/utils/shim_util.py#L278
Contributor guide
Research direction
Inspect gslib/utils/shim_util.py around line 278, where the .boto value is translated into the api_endpoint_overrides/storage property. Reproduce the reported gsutil command with the shown .boto configuration and verify that the translated endpoint is an absolute URI with the required trailing slash and is accepted without the validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100