Skip to content

Commit f40bc33

Browse files
committed
Quick fix for running on local filesystem mode.
1 parent 2e0f793 commit f40bc33

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

datashuttle/utils/rclone.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ def call_rclone_through_script_for_central_connection(
115115
shell=False,
116116
)
117117

118-
output = run_function_that_requires_encrypted_rclone_config_access(
119-
cfg, lambda_func
120-
)
118+
if cfg["connection_method"] in ["ssh", "gdrive", "aws"]:
119+
output = run_function_that_requires_encrypted_rclone_config_access(
120+
cfg, lambda_func
121+
)
122+
else:
123+
output = lambda_func()
121124

122125
if output.returncode != 0:
123126
prompt_rclone_download_if_does_not_exist()
@@ -662,9 +665,15 @@ def transfer_data(
662665
f'{central_filepath}" "{local_filepath}" {extra_arguments} {get_config_arg(cfg)} --ask-password=false', # TODO: handle the error
663666
)
664667

665-
if cfg.rclone.get_rclone_config_encryption_state():
668+
if (
669+
cfg["connection_method"] in ["ssh", "aws", "gdrive"]
670+
and cfg.rclone.get_rclone_config_encryption_state()
671+
): # TODO: this is a quick and dirty fix but this MUST be handled better
666672
rclone_encryption.remove_credentials_as_password_command()
667673

674+
# 1) now 'for central connection' terminology is confused, one is for all and the other checks internally if it is aws or not. This is okay but must be consistent
675+
# 2) make a utils function to do the connection method check, this is still kind of weird / error prone
676+
668677
return output
669678

670679

tests/tests_integration/test_create_folders.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ def test_all_top_level_folders(self, project, top_level_folder):
309309

310310
@pytest.mark.parametrize("top_level_folder", ["rawdata", "derivatives"])
311311
@pytest.mark.parametrize("return_with_prefix", [True, False])
312-
def test_get_next_sub(self, project, return_with_prefix, top_level_folder):
312+
def test_get_next_sub__(
313+
self, project, return_with_prefix, top_level_folder
314+
):
313315
"""Test that the next subject number is suggested correctly.
314316
This takes the union of subjects available in the local and
315317
central repository. As such test the case where either are

0 commit comments

Comments
 (0)