Skip to content

Commit

Permalink
Merge pull request #16 from gdiepen/add_support_for_data_proxy
Browse files Browse the repository at this point in the history
Add support for data proxy
  • Loading branch information
efiop authored Nov 9, 2023
2 parents a47ee21 + f4a4fcc commit b1b4fe8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dvc_webhdfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ def _prepare_credentials(self, **config):
principal = config.pop("kerberos_principal", None)
if principal:
config["kerb_kwargs"] = {"principal": principal}

# If target data_proxy provided construct the source from host/port
data_proxy_target = config.pop("data_proxy_target", None)
if data_proxy_target:
host = config["host"]
port = config["port"]

protocol = "https" if config.get("use_https") else "http"

source_url = f"{protocol}://{host}:{port}/webhdfs/v1"
config["data_proxy"] = {source_url: data_proxy_target}
return config

@wrap_prop(threading.Lock())
Expand Down

0 comments on commit b1b4fe8

Please sign in to comment.