From f1d5e1b5f75b9b6c953f78532de4241928559c6e Mon Sep 17 00:00:00 2001 From: Aaron Kanzer Date: Tue, 9 Apr 2024 07:24:06 -0400 Subject: [PATCH 1/3] Include explicit auth call on move cmd --- lincbrain/move.py | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lincbrain/move.py b/lincbrain/move.py index 9996212bb..cbe571de8 100644 --- a/lincbrain/move.py +++ b/lincbrain/move.py @@ -812,6 +812,7 @@ def move( 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) remote_ds = client.get_dandiset( local_ds.identifier, version_id="draft", lazy=False @@ -841,6 +842,7 @@ def move( else: local_ds, subpath = find_dandiset_and_subpath(dandiset) client = DandiAPIClient.for_dandi_instance(dandi_instance) + client.dandi_authenticate() stack.enter_context(client) remote_ds = client.get_dandiset( local_ds.identifier, version_id="draft", lazy=False diff --git a/setup.py b/setup.py index a2777529e..1a6e8e460 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ import versioneer setup_kw = { - "version": versioneer.get_version(), + "version": "0.8.0", "cmdclass": versioneer.get_cmdclass(), } except ImportError: From 8b8fbf9a0fda1adf2e090954b631ec215d8f2165 Mon Sep 17 00:00:00 2001 From: Aaron Kanzer Date: Tue, 9 Apr 2024 16:35:30 -0400 Subject: [PATCH 2/3] Include logic to properly authenticate a user upon the move command --- lincbrain/move.py | 21 +++++++++++++-------- setup.py | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lincbrain/move.py b/lincbrain/move.py index cbe571de8..ea5b613d1 100644 --- a/lincbrain/move.py +++ b/lincbrain/move.py @@ -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: @@ -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 ) @@ -834,6 +838,7 @@ 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 @@ -841,9 +846,9 @@ def move( 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 ) @@ -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: diff --git a/setup.py b/setup.py index 1a6e8e460..a7c6429ff 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ import versioneer setup_kw = { - "version": "0.8.0", + "version": "0.8.4", "cmdclass": versioneer.get_cmdclass(), } except ImportError: From 40a8c76b54deeb9ddd86d1d49095c1fc9bfb252c Mon Sep 17 00:00:00 2001 From: Aaron Kanzer Date: Tue, 9 Apr 2024 16:37:01 -0400 Subject: [PATCH 3/3] cleanup --- lincbrain/move.py | 10 ++-------- setup.py | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lincbrain/move.py b/lincbrain/move.py index ea5b613d1..fb40d34e2 100644 --- a/lincbrain/move.py +++ b/lincbrain/move.py @@ -815,9 +815,6 @@ 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, authenticate=True) - # client.dandi_authenticate() - # stack.enter_context(client) remote_ds = client.get_dandiset( local_ds.identifier, version_id="draft", lazy=False ) @@ -846,9 +843,6 @@ def move( subpath = Path() else: local_ds, subpath = find_dandiset_and_subpath(dandiset) - # 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 ) @@ -873,8 +867,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: diff --git a/setup.py b/setup.py index a7c6429ff..a2777529e 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ import versioneer setup_kw = { - "version": "0.8.4", + "version": versioneer.get_version(), "cmdclass": versioneer.get_cmdclass(), } except ImportError: