Skip to content

Commit 18706d7

Browse files
authored
refactor: fix variable names in MinIO support (#112)
1 parent b887de2 commit 18706d7

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66

77
### Added
88

9-
* Support for JuliaHub instances using MinIO as datasets storage backend.
9+
* Support for JuliaHub instances using MinIO as datasets storage backend. ([#107], [#112])
1010

1111
### Fixed
1212

@@ -208,3 +208,6 @@ Initial package release.
208208
[#99]: https://github.com/JuliaComputing/JuliaHub.jl/issues/99
209209
[#100]: https://github.com/JuliaComputing/JuliaHub.jl/issues/100
210210
[#103]: https://github.com/JuliaComputing/JuliaHub.jl/issues/103
211+
[#107]: https://github.com/JuliaComputing/JuliaHub.jl/issues/107
212+
[#111]: https://github.com/JuliaComputing/JuliaHub.jl/issues/111
213+
[#112]: https://github.com/JuliaComputing/JuliaHub.jl/issues/112

src/datasets.jl

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -868,15 +868,15 @@ function _write_rclone_config(
868868
access_key_id::AbstractString,
869869
secret_access_key::AbstractString,
870870
session_token::AbstractString,
871-
provider::AbstractString="AWS",
872-
endpoint::AbstractString="",
871+
vendor::AbstractString,
872+
endpoint::AbstractString,
873873
)
874-
if lowercase(provider) == "aws"
875-
provider = "AWS"
876-
elseif lowercase(provider) == "minio"
877-
provider = "Minio"
874+
provider = if vendor == "aws"
875+
"AWS"
876+
elseif vendor == "minio"
877+
"Minio"
878878
else
879-
throw(JuliaHubError("Unknown storage backend $(provider)"))
879+
throw(JuliaHubError("Unknown storage backend $(vendor)"))
880880
end
881881

882882
write(
@@ -904,10 +904,10 @@ function _write_rclone_config(io::IO, upload_config::Dict)
904904
access_key_id = upload_config["credentials"]["access_key_id"]
905905
secret_access_key = upload_config["credentials"]["secret_access_key"]
906906
session_token = upload_config["credentials"]["session_token"]
907-
provider = upload_config["vendor"]
907+
vendor = upload_config["vendor"]
908908
endpoint = get(upload_config["credentials"], "endpoint_url", "")
909909
_write_rclone_config(
910-
io; region, access_key_id, secret_access_key, session_token, provider, endpoint
910+
io; region, access_key_id, secret_access_key, session_token, vendor, endpoint
911911
)
912912
end
913913

@@ -1002,9 +1002,10 @@ function download_dataset(
10021002
throw(InvalidRequestError("Dataset '$(dataset.name)' does not have version 'v$version'"))
10031003

10041004
credentials = Mocking.@mock _get_dataset_credentials(auth, dataset)
1005-
provider = credentials["vendor"]
1006-
provider in ("aws", "minio") ||
1007-
throw(JuliaHubError("Unknown 'vendor': $(credentials["vendor"])"))
1005+
vendor = credentials["vendor"]
1006+
if !(vendor in ("aws", "minio"))
1007+
throw(JuliaHubError("Unknown 'vendor': $(vendor)"))
1008+
end
10081009
credentials = credentials["credentials"]
10091010
endpoint = get(credentials, "endpoint_url", "")
10101011

@@ -1035,7 +1036,7 @@ function download_dataset(
10351036
access_key_id=credentials["access_key_id"],
10361037
secret_access_key=credentials["secret_access_key"],
10371038
session_token=credentials["session_token"],
1038-
provider=provider,
1039+
vendor=vendor,
10391040
endpoint=endpoint,
10401041
)
10411042
close(rclone_conf_io)

0 commit comments

Comments
 (0)