Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Include logic to properly authenticate a user upon the move command
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Kanzer authored and Aaron Kanzer committed Apr 9, 2024
1 parent f1d5e1b commit 8b8fbf9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions lincbrain/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,10 @@ def move(
if dandiset is None:
dandiset = Path()
with ExitStack() as stack:
client = DandiAPIClient.for_dandi_instance(dandi_instance)
client.dandi_authenticate()
stack.enter_context(client)

mover: Mover
client: DandiAPIClient | None = None
if work_on is MoveWorkOn.AUTO:
Expand All @@ -811,9 +815,9 @@ def move(
if isinstance(dandiset, str):
raise TypeError("`dandiset` must be a Path when work_on='both'")
local_ds, subpath = find_dandiset_and_subpath(dandiset)
client = DandiAPIClient.for_dandi_instance(dandi_instance)
client.dandi_authenticate()
stack.enter_context(client)
# client = DandiAPIClient.for_dandi_instance(dandi_instance, authenticate=True)
# client.dandi_authenticate()
# stack.enter_context(client)
remote_ds = client.get_dandiset(
local_ds.identifier, version_id="draft", lazy=False
)
Expand All @@ -834,16 +838,17 @@ def move(
if not isinstance(url, DandisetURL):
raise ValueError("URL does not point to a Dandiset")
client = url.get_client()
client.dandi_authenticate()
stack.enter_context(client)
rds = url.get_dandiset(client, lazy=False)
assert rds is not None
remote_ds = rds
subpath = Path()
else:
local_ds, subpath = find_dandiset_and_subpath(dandiset)
client = DandiAPIClient.for_dandi_instance(dandi_instance)
client.dandi_authenticate()
stack.enter_context(client)
# client = DandiAPIClient.for_dandi_instance(dandi_instance, authenticate=True)
# client.dandi_authenticate()
# stack.enter_context(client)
remote_ds = client.get_dandiset(
local_ds.identifier, version_id="draft", lazy=False
)
Expand All @@ -868,8 +873,8 @@ def move(
if not plan:
lgr.info("Nothing to move")
return
if not dry_run and client is not None:
client.dandi_authenticate()
# if not dry_run and client is not None:
# client.dandi_authenticate()
if devel_debug:
for gen in mover.process_moves_debug(plan, dry_run):
for r in gen:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import versioneer

setup_kw = {
"version": "0.8.0",
"version": "0.8.4",
"cmdclass": versioneer.get_cmdclass(),
}
except ImportError:
Expand Down

0 comments on commit 8b8fbf9

Please sign in to comment.