Skip to content

Commit b1b4fe8

Browse files
authored
Merge pull request #16 from gdiepen/add_support_for_data_proxy
Add support for data proxy
2 parents a47ee21 + f4a4fcc commit b1b4fe8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dvc_webhdfs/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ def _prepare_credentials(self, **config):
4242
principal = config.pop("kerberos_principal", None)
4343
if principal:
4444
config["kerb_kwargs"] = {"principal": principal}
45+
46+
# If target data_proxy provided construct the source from host/port
47+
data_proxy_target = config.pop("data_proxy_target", None)
48+
if data_proxy_target:
49+
host = config["host"]
50+
port = config["port"]
51+
52+
protocol = "https" if config.get("use_https") else "http"
53+
54+
source_url = f"{protocol}://{host}:{port}/webhdfs/v1"
55+
config["data_proxy"] = {source_url: data_proxy_target}
4556
return config
4657

4758
@wrap_prop(threading.Lock())

0 commit comments

Comments
 (0)