Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(worker): Allow for remote.log existing without s3-PUBLIC in validation #3064

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions services/datalad/datalad_service/common/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ def validate_s3_config(dataset_path):
else:
raise
options_line = ''
for line in remote_log.stdout:
for line in remote_log.stdout.split('\n'):
if f'name={get_s3_remote()}' in line:
options_line = line
# check that each of the expected annex options is what's actually configured
expected_options = generate_s3_annex_options(dataset_path)
for expected_option in expected_options:
if not expected_option in options_line:
return False
if options_line:
# check that each of the expected annex options is what's actually configured
expected_options = generate_s3_annex_options(dataset_path)
for expected_option in expected_options:
if not expected_option in options_line:
return False
return True


Expand Down
12 changes: 7 additions & 5 deletions services/datalad/tests/test_common_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ def test_update_s3_sibling(monkeypatch, no_init_remote, new_dataset):
update_s3_sibling(new_dataset.path)


def test_validate_s3_config(monkeypatch, no_init_remote, new_dataset):
monkeypatch.setattr(datalad_service.config,
'AWS_S3_PUBLIC_BUCKET', 'a-fake-test-public-bucket')
create_remotes(new_dataset.path)
# Should fail since the no_init_remote version doesn't match the expected config
def test_validate_s3_config(no_init_remote, new_dataset):
annex_options = generate_s3_annex_options(new_dataset.path)
# Set a bad option
annex_options = ['type=web']
# check=False because this will fail when talking to S3
subprocess.run(['git-annex', 'initremote', get_s3_remote()] +
annex_options, check=False, cwd=new_dataset.path)
assert not validate_s3_config(new_dataset.path)
Loading